本文整理汇总了Java中android.view.MenuItem.setIntent方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.setIntent方法的具体用法?Java MenuItem.setIntent怎么用?Java MenuItem.setIntent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.MenuItem
的用法示例。
在下文中一共展示了MenuItem.setIntent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOptionsItemSelected
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.menu_whats_new) {
sp.save("hideLatest" + PkgUtil.getAppVer(this, "%1$s"), true);
item.setIntent(new Intent(this, WhatsNewActivity.class));
return super.onOptionsItemSelected(item);
} else if (id == R.id.menu_search) {
item.setIntent(new Intent(this, SearchActivity.class));
return super.onOptionsItemSelected(item);
} else if (id == R.id.menu_apply) {
(new ApplyDialog()).show(getSupportFragmentManager(), "applyDialog");
return true;
} else if (id == R.id.menu_about) {
item.setIntent(new Intent(this, AboutActivity.class));
return super.onOptionsItemSelected(item);
}
return super.onOptionsItemSelected(item);
}
示例2: onCreateOptionsMenu
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.detail, menu);
MenuItem menuItem = menu.findItem(R.id.action_share);
menuItem.setIntent(createShareForecastIntent());
return true;
}
示例3: onCreateOptionsMenu
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.detail, menu);
MenuItem menuItem = menu.findItem(R.id.action_share);
menuItem.setIntent(createShareForecastIntent());
return super.onCreateOptionsMenu(menu);
}
示例4: createModesMenu
import android.view.MenuItem; //导入方法依赖的package包/类
private void createModesMenu(Menu menu) {
SubMenu modesSubMenu = menu.findItem(R.id.action_modes).getSubMenu();
IModeInfo[] modeInfoList = mEncoder.getModeInfoList();
for (IModeInfo modeInfo : modeInfoList) {
MenuItem item = modesSubMenu.add(modeInfo.getModeName());
Intent intent = new Intent();
intent.putExtra(CLASS_NAME, modeInfo.getModeClassName());
item.setIntent(intent);
}
}
示例5: finishCreatingMenu
import android.view.MenuItem; //导入方法依赖的package包/类
private void finishCreatingMenu(Menu menu) {
// Retrieve the share menu item
MenuItem menuItem = menu.findItem(R.id.action_share);
menuItem.setIntent(createShareForecastIntent());
}
示例6: configureMenuItem
import android.view.MenuItem; //导入方法依赖的package包/类
public void configureMenuItem(MenuItem item, IntentBuilder shareIntent) {
item.setIntent(shareIntent.createChooserIntent());
}