android.view.MenuItem.getIntent()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(108)

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

暂无

代码示例

代码示例来源:origin: square/assertj-android

public MenuItemAssert hasIntent(Intent intent) {
 isNotNull();
 Intent actualIntent = actual.getIntent();
 assertThat(actualIntent) //
   .overridingErrorMessage("Expected intent <%s> but was <%s>.", intent, actualIntent) //
   .isEqualTo(intent);
 return this;
}

代码示例来源:origin: com.actionbarsherlock/actionbarsherlock

@Override
public Intent getIntent() {
  return mNativeItem.getIntent();
}

代码示例来源:origin: com.willowtreeapps/oak-demos

@Override
public Intent getIntent() {
  return mNativeItem.getIntent();
}

代码示例来源:origin: stackoverflow.com

@Override
public boolean onOptionsItemSelected(MenuItem item) {
  // TODO Auto-generated method stub
  switch (item.getItemId()) {
  case 100:
    LevelOptionIntent levelOptionIntent = (LevelOptionIntent) item
        .getIntent();
    //Perform what you would want to based on the values set in the intent.
    if (levelOptionIntent.getAppCode().equals(A)) {
    // Start activity A
    }elseif (levelOptionIntent.getAppCode().equals(B)) {
    // Start activity B
    }else if (levelOptionIntent.getAppCode().equals(C)) {
    // Start activity C
    }

    break;
  }
  return true;
}

代码示例来源:origin: clemensbartz/essential-launcher

@Override
  public boolean onMenuItemClick(final MenuItem item) {
    final ComponentName provider = item.getIntent().getParcelableExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER);
    if (provider != null) {
      launcher.bindWidget(provider, item.getIntent().getComponent());
    }
    return true;
  }
});

代码示例来源:origin: stackoverflow.com

//Methods for menu
// display the menu when menu botton clicked

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  super.onCreateOptionsMenu(menu);
  getMenuInflater().inflate(R.menu.lightmeter, menu);
  menu.findItem(R.id.about).setIntent(new Intent(this, about.class));
  menu.findItem(R.id.edit).setIntent(new Intent(this, menu.class));
  return true;
}

//methods for menu
//StartActivity for selecion

@Override
public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item);
startActivity(item.getIntent());
return true;
}

代码示例来源:origin: PrivacyApps/document-viewer

public static void setActionParameters(final MenuItem item, final ActionEx action) {
  final Intent intent = item.getIntent();
  final Bundle extras = intent != null ? intent.getExtras() : null;
  if (extras != null) {
    for (final String key : extras.keySet()) {
      final ExtraWrapper w = (ExtraWrapper) extras.getSerializable(key);
      action.putValue(key, w != null ? w.data : null);
    }
  }
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public MenuItemAssert hasIntent(Intent intent) {
 isNotNull();
 Intent actualIntent = actual.getIntent();
 assertThat(actualIntent) //
   .overridingErrorMessage("Expected intent <%s> but was <%s>.", intent, actualIntent) //
   .isEqualTo(intent);
 return this;
}

代码示例来源:origin: PrivacyApps/document-viewer

public static void setMenuItemExtra(final MenuItem item, final String name, final Object data) {
  Intent intent = item.getIntent();
  if (intent == null) {
    intent = new Intent();
    item.setIntent(intent);
  }
  intent.putExtra(name, new ExtraWrapper(data));
}

代码示例来源:origin: hieuapp/android-firebase-chat

int posGroup = item.getIntent().getIntExtra(CONTEXT_MENU_KEY_INTENT_DATA_POS, -1);
if(((String)listGroup.get(posGroup).groupInfo.get("admin")).equals(StaticConfig.UID)) {
  Group group = listGroup.get(posGroup);
int posGroup1 = item.getIntent().getIntExtra(CONTEXT_MENU_KEY_INTENT_DATA_POS, -1);
if(((String)listGroup.get(posGroup1).groupInfo.get("admin")).equals(StaticConfig.UID)) {
  Intent intent = new Intent(getContext(), AddGroupActivity.class);
int position = item.getIntent().getIntExtra(CONTEXT_MENU_KEY_INTENT_DATA_POS, -1);
if(((String)listGroup.get(position).groupInfo.get("admin")).equals(StaticConfig.UID)) {
  Toast.makeText(getActivity(), "Admin cannot leave group", Toast.LENGTH_LONG).show();

代码示例来源:origin: stackoverflow.com

Intent i = item.getIntent();
if (i != null) {
  Bundle b = i.getExtras();

代码示例来源:origin: stackoverflow.com

Intent i = item.getIntent();
if (i != null) {
  Bundle b = i.getExtras();

代码示例来源:origin: stackoverflow.com

public boolean onMenuItemClick(MenuItem item) {
  prepareImageToShare(true);
  startActivity(item.getIntent());
  return true;

代码示例来源:origin: clemensbartz/essential-launcher

@Override
public boolean onContextItemSelected(final MenuItem item) {
  if (item.getIntent() == null && contextMenuApplicationModel != null) {
    switch (item.getItemId()) {
      case ITEM_RESET:
        new ResetUsageAsyncTask(this, model).execute(contextMenuApplicationModel);
        break;
      case ITEM_TOGGLE_DISABLED:
        new ToggleDockAsyncTask(this, model).execute(contextMenuApplicationModel);
        break;
      case ITEM_TOGGLE_STICKY:
        new ToggleStickyAsyncTask(this, model).execute(contextMenuApplicationModel);
        break;
      case ITEM_TOGGLE_HIDDEN:
        new ToggleHiddenAsyncTask(this, model).execute(contextMenuApplicationModel);
        break;
      default:
        break;
    }
    // "Consume" the model
    contextMenuApplicationModel = null;
    return true;
  }
  return false;
}

代码示例来源:origin: openintents/notepad

startTextSelectionActivity(item.getIntent());

相关文章