android.content.Intent.getIntArrayExtra()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(273)

本文整理了Java中android.content.Intent.getIntArrayExtra()方法的一些代码示例,展示了Intent.getIntArrayExtra()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Intent.getIntArrayExtra()方法的具体详情如下:
包路径:android.content.Intent
类名称:Intent
方法名:getIntArrayExtra

Intent.getIntArrayExtra介绍

暂无

代码示例

代码示例来源:origin: google/ExoPlayer

@SuppressLint("InlinedApi")
/* package */ static AudioCapabilities getCapabilities(@Nullable Intent intent) {
 if (intent == null || intent.getIntExtra(AudioManager.EXTRA_AUDIO_PLUG_STATE, 0) == 0) {
  return DEFAULT_AUDIO_CAPABILITIES;
 }
 return new AudioCapabilities(
   intent.getIntArrayExtra(AudioManager.EXTRA_ENCODINGS),
   intent.getIntExtra(
     AudioManager.EXTRA_MAX_CHANNEL_COUNT, /* defaultValue= */ DEFAULT_MAX_CHANNEL_COUNT));
}

代码示例来源:origin: pockethub/PocketHub

/**
 * Get intent extra
 *
 * @param name
 * @return int array
 */
protected int[] getIntArrayExtra(final String name) {
  return getIntent().getIntArrayExtra(name);
}

代码示例来源:origin: facebook/litho

@Override
public @Nullable Intent getParentActivityIntent() {
 int[] indices = getIntent().getIntArrayExtra(DemoListActivity.INDICES);
 if (indices == null) {
  return null;
 }
 final Intent parentIntent = new Intent(this, DemoListActivity.class);
 if (indices.length > 1) {
  parentIntent.putExtra(DemoListActivity.INDICES, Arrays.copyOf(indices, indices.length - 1));
 }
 return parentIntent;
}

代码示例来源:origin: facebook/litho

@Override
protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 int[] indices = getIntent().getIntArrayExtra(DemoListActivity.INDICES);
 if (indices != null) {
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  setTitleFromIndices(indices);
 }
}

代码示例来源:origin: k9mail/k-9

@Override
public void onReceive(Context context, Intent intent) {
  super.onReceive(context, intent);
  String action = intent.getAction();
  if (action.equals(ACTION_UPDATE_MESSAGE_LIST)) {
    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
    int[] appWidgetIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
    appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.listView);
  }
}

代码示例来源:origin: hidroh/materialistic

@Override
public void onReceive(Context context, Intent intent) {
  if (TextUtils.equals(intent.getAction(), ACTION_REFRESH_WIDGET)) {
    int appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
        AppWidgetManager.INVALID_APPWIDGET_ID);
    new WidgetHelper(context).refresh(appWidgetId);
  } else if (TextUtils.equals(intent.getAction(), AppWidgetManager.ACTION_APPWIDGET_UPDATE)) {
    int[] appWidgetIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
    if (appWidgetIds != null) {
      WidgetHelper widgetHelper = new WidgetHelper(context);
      for (int appWidgetId : appWidgetIds) {
        widgetHelper.configure(appWidgetId);
      }
    }
  } else {
    super.onReceive(context, intent);
  }
}

代码示例来源:origin: TommyLemon/APIJSON

minDateDetails = intent.getIntArrayExtra(INTENT_MIN_DATE);
maxDateDetails = intent.getIntArrayExtra(INTENT_MAX_DATE);
defaultDateDetails = intent.getIntArrayExtra(INTENT_DEFAULT_DATE);

代码示例来源:origin: TommyLemon/APIJSON

private void init() {
  llTopMenuWindowBg = findViewById(R.id.llTopMenuWindowBg);
  llTopMenuWindowBg.setOnClickListener(this);
  Intent intent = getIntent();
  int[] intentCodes = intent.getIntArrayExtra(INTENT_INTENTCODES);
  if (intentCodes == null || intentCodes.length <= 0) {
    intentCodeList = intent.getIntegerArrayListExtra(INTENT_INTENTCODES);
  } else {
    intentCodeList = new ArrayList<Integer>();
    for (int code : intentCodes) {
      intentCodeList.add(code);
    }
  }
  String[] menuItems = intent.getStringArrayExtra(INTENT_NAMES);
  if (menuItems == null || menuItems.length <= 0) {
    nameList = intent.getStringArrayListExtra(INTENT_NAMES);
  } else {
    nameList = new ArrayList<String>(Arrays.asList(menuItems));
  }
  if (nameList == null || nameList.size() <= 0) {
    Log.e(TAG, "init   nameList == null || nameList.size() <= 0 >> finish();return;");
    finish();
    return;
  }
  adapter = new ArrayAdapter<String>(this, R.layout.top_menu_list_item, R.id.tvTopMenuListItem, nameList);
  lvTopMenu = (ListView) findViewById(R.id.lvTopMenuWindowMenu);
  lvTopMenu.setAdapter(adapter);
  lvTopMenu.setOnItemClickListener(this);
}

代码示例来源:origin: TommyLemon/APIJSON

minTimeDetails = intent.getIntArrayExtra(INTENT_MIN_TIME);
maxTimeDetails = intent.getIntArrayExtra(INTENT_MAX_TIME);
defaultTimeDetails = intent.getIntArrayExtra(INTENT_DEFAULT_TIME);

代码示例来源:origin: TommyLemon/Android-ZBLibrary

private void init() {
  llTopMenuWindowBg = findViewById(R.id.llTopMenuWindowBg);
  llTopMenuWindowBg.setOnClickListener(this);
  Intent intent = getIntent();
  int[] intentCodes = intent.getIntArrayExtra(INTENT_INTENTCODES);
  if (intentCodes == null || intentCodes.length <= 0) {
    intentCodeList = intent.getIntegerArrayListExtra(INTENT_INTENTCODES);
  } else {
    intentCodeList = new ArrayList<Integer>();
    for (int code : intentCodes) {
      intentCodeList.add(code);
    }
  }
  String[] menuItems = intent.getStringArrayExtra(INTENT_NAMES);
  if (menuItems == null || menuItems.length <= 0) {
    nameList = intent.getStringArrayListExtra(INTENT_NAMES);
  } else {
    nameList = new ArrayList<String>(Arrays.asList(menuItems));
  }
  if (nameList == null || nameList.size() <= 0) {
    Log.e(TAG, "init   nameList == null || nameList.size() <= 0 >> finish();return;");
    finish();
    return;
  }
  adapter = new ArrayAdapter<String>(this, R.layout.top_menu_list_item, R.id.tvTopMenuListItem, nameList);
  lvTopMenu = findViewById(R.id.lvTopMenuWindowMenu);
  lvTopMenu.setAdapter(adapter);
  lvTopMenu.setOnItemClickListener(this);
}

代码示例来源:origin: TommyLemon/Android-ZBLibrary

minDateDetails = intent.getIntArrayExtra(INTENT_MIN_DATE);
maxDateDetails = intent.getIntArrayExtra(INTENT_MAX_DATE);
defaultDateDetails = intent.getIntArrayExtra(INTENT_DEFAULT_DATE);

代码示例来源:origin: TommyLemon/Android-ZBLibrary

minTimeDetails = intent.getIntArrayExtra(INTENT_MIN_TIME);
maxTimeDetails = intent.getIntArrayExtra(INTENT_MAX_TIME);
defaultTimeDetails = intent.getIntArrayExtra(INTENT_DEFAULT_TIME);

代码示例来源:origin: TommyLemon/APIJSON

int[] ids = intent.getIntArrayExtra(INTENT_ITEM_IDS);
if (ids == null || ids.length <= 0) {
  idList = intent.getIntegerArrayListExtra(INTENT_ITEM_IDS);

代码示例来源:origin: TommyLemon/Android-ZBLibrary

int[] ids = intent.getIntArrayExtra(INTENT_ITEM_IDS);
if (ids == null || ids.length <= 0) {
  idList = intent.getIntegerArrayListExtra(INTENT_ITEM_IDS);

代码示例来源:origin: robolectric/robolectric

@Test
public void testIntArrayExtra() throws Exception {
 Intent intent = new Intent();
 int[] array = new int[2];
 array[0] = 1;
 array[1] = 2;
 assertSame(intent, intent.putExtra("foo", array));
 assertEquals(1, intent.getIntArrayExtra("foo")[0]);
 assertEquals(2, intent.getIntArrayExtra("foo")[1]);
}

代码示例来源:origin: Yalantis/uCrop

int[] allowedGestures = intent.getIntArrayExtra(UCrop.Options.EXTRA_ALLOWED_GESTURES);
if (allowedGestures != null && allowedGestures.length == TABS_COUNT) {
  mAllowedGestures = allowedGestures;

代码示例来源:origin: cSploit/android

actions = intent.getIntArrayExtra(MULTI_ACTIONS);
targetsIndex = intent.getIntArrayExtra(MULTI_TARGETS);

代码示例来源:origin: frogermcs/InstaMaterial

private void setupRevealBackground(Bundle savedInstanceState) {
  vRevealBackground.setOnStateChangeListener(this);
  if (savedInstanceState == null) {
    final int[] startingLocation = getIntent().getIntArrayExtra(ARG_REVEAL_START_LOCATION);
    vRevealBackground.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
      @Override
      public boolean onPreDraw() {
        vRevealBackground.getViewTreeObserver().removeOnPreDrawListener(this);
        vRevealBackground.startFromLocation(startingLocation);
        return true;
      }
    });
  } else {
    vRevealBackground.setToFinishedFrame();
    userPhotosAdapter.setLockedAnimations(true);
  }
}

代码示例来源:origin: frogermcs/InstaMaterial

private void setupRevealBackground(Bundle savedInstanceState) {
  vRevealBackground.setFillPaintColor(0xFF16181a);
  vRevealBackground.setOnStateChangeListener(this);
  if (savedInstanceState == null) {
    final int[] startingLocation = getIntent().getIntArrayExtra(ARG_REVEAL_START_LOCATION);
    vRevealBackground.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
      @Override
      public boolean onPreDraw() {
        vRevealBackground.getViewTreeObserver().removeOnPreDrawListener(this);
        vRevealBackground.startFromLocation(startingLocation);
        return true;
      }
    });
  } else {
    vRevealBackground.setToFinishedFrame();
  }
}

代码示例来源:origin: facebook/litho

@Override
public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 final int[] indices = getIntent().getIntArrayExtra(INDICES);
 final List<DemoListDataModel> dataModels = getDataModels(indices);
 final ComponentContext componentContext = new ComponentContext(this);
 setContentView(
   LithoView.create(
     this,
     DemoListComponent.create(componentContext)
       .dataModels(dataModels)
       .parentIndices(indices)
       .build()));
}

相关文章

Intent类方法