本文整理匯總了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());
}