Java Code Examples for android.view.Menu

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project Android-FFXIEQ, under directory /ffxieq/src/com/github/kanata3249/ffxieq/android/.

Source file: MeritPointEditActivity.java

  17 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.meritpointedit,menu);
  String jobtitles[]=getResources().getStringArray(R.array.Jobs);
  Menu submenu=menu.findItem(R.id.JobSpecificMeritPoint).getSubMenu();
  submenu.findItem(R.id.JobSpecificMeritPointEdit01).setTitle(jobtitles[0]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit02).setTitle(jobtitles[1]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit03).setTitle(jobtitles[2]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit04).setTitle(jobtitles[3]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit05).setTitle(jobtitles[4]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit06).setTitle(jobtitles[5]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit07).setTitle(jobtitles[6]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit08).setTitle(jobtitles[7]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit09).setTitle(jobtitles[8]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit10).setTitle(jobtitles[9]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit11).setTitle(jobtitles[10]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit12).setTitle(jobtitles[11]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit13).setTitle(jobtitles[12]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit14).setTitle(jobtitles[13]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit15).setTitle(jobtitles[14]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit16).setTitle(jobtitles[15]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit17).setTitle(jobtitles[16]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit18).setTitle(jobtitles[17]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit19).setTitle(jobtitles[18]);
  submenu.findItem(R.id.JobSpecificMeritPointEdit20).setTitle(jobtitles[19]);
  return true;
}
 

Example 2

From project abalone-android, under directory /src/com/bytopia/abalone/.

Source file: MainMenuActivity.java

  16 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.menu,menu);
  return true;
}
 

Example 3

From project AChartEngine, under directory /client/src/org/achartengine/demo/.

Source file: Demo.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.options_main,menu);
  return true;
}
 

Example 4

From project ActionBarCompat, under directory /ActionBarCompat/src/sk/m217/actionbarcompat/.

Source file: ActionBarActivity.java

  15 
vote

/** 
 * Base action bar-aware implementation for {@link Activity#onCreateOptionsMenu(android.view.Menu)}. Note: marking menu items as invisible/visible is not currently supported.
 */
@Override public boolean onCreateOptionsMenu(Menu menu){
  boolean retValue=false;
  retValue|=mActionBarHelper.onCreateOptionsMenu(menu);
  retValue|=super.onCreateOptionsMenu(menu);
  return retValue;
}
 

Example 5

From project aksunai, under directory /src/org/androidnerds/app/aksunai/.

Source file: Aksunai.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,NEW_SERVER,1,R.string.menu_new_server).setIcon(android.R.drawable.ic_menu_add);
  menu.add(0,SETTINGS,2,R.string.settings).setIcon(android.R.drawable.ic_menu_preferences);
  return true;
}
 

Example 6

From project alljoyn_java, under directory /samples/android/contacts/ContactsClient/src/org/alljoyn/bus/samples/contacts_client/.

Source file: ContactsClient.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.mainmenu,menu);
  this.menu=menu;
  return true;
}
 

Example 7

From project and-bible, under directory /AndBible/src/net/bible/android/control/backup/.

Source file: BackupControl.java

  15 
vote

public void updateOptionsMenu(Menu menu){
  MenuItem restoreMenuItem=menu.findItem(R.id.restore);
  if (restoreMenuItem != null) {
    restoreMenuItem.setEnabled(isBackupFile());
  }
}
 

Example 8

From project Android-automation, under directory /TmtsApp/src/com/taobao/tmts/framework/app/.

Source file: MainActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  menu.add(Menu.NONE,1,Menu.NONE,"Dialog");
  menu.add(Menu.NONE,2,Menu.NONE,"Tosat");
  menu.add(Menu.NONE,3,Menu.NONE,"Dialog With List");
  return super.onCreateOptionsMenu(menu);
}
 

Example 9

From project android-bankdroid, under directory /src/com/liato/bankdroid/.

Source file: MainActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(final Menu menu){
  super.onCreateOptionsMenu(menu);
  final MenuInflater inflater=new MenuInflater(this);
  inflater.inflate(R.menu.menu,menu);
  return true;
}
 

Example 10

From project android-context, under directory /defunct/.

Source file: ContextBrowserActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  menu.add(Menu.NONE,ADD_ID,Menu.NONE,"Add").setIcon(R.drawable.add64).setAlphabeticShortcut('a');
  menu.add(Menu.NONE,GEO_ID,Menu.NONE,"Geo Loc").setIcon(R.drawable.add64).setAlphabeticShortcut('g');
  menu.add(Menu.NONE,WEATHER_ID,Menu.NONE,"Weather").setIcon(R.drawable.add64).setAlphabeticShortcut('w');
  menu.add(Menu.NONE,PHONE_ID,Menu.NONE,"Phone").setIcon(R.drawable.add64).setAlphabeticShortcut('p');
  menu.add(Menu.NONE,SMS_ID,Menu.NONE,"SMS").setIcon(R.drawable.add64).setAlphabeticShortcut('s');
  return (super.onCreateOptionsMenu(menu));
}
 

Example 11

From project Android-File-Manager, under directory /src/com/nexes/manager/.

Source file: Main.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  menu.add(0,MENU_MKDIR,0,"New Directory").setIcon(R.drawable.newfolder);
  menu.add(0,MENU_SEARCH,0,"Search").setIcon(R.drawable.search);
  menu.add(0,MENU_SETTING,0,"Settings").setIcon(R.drawable.setting);
  menu.add(0,MENU_QUIT,0,"Quit").setIcon(R.drawable.logout);
  return true;
}
 

Example 12

From project Android-File-Manager-Tablet, under directory /src/com/nexes/manager/tablet/.

Source file: DirContentActivity.java

  15 
vote

@Override public boolean onCreateActionMode(ActionMode mode,Menu menu){
  menu.add(0,D_MENU_BOOK,0,"Bookmark");
  menu.add(0,D_MENU_INFO,0,"Info");
  menu.add(0,D_MENU_DELETE,0,"Delete");
  menu.add(0,D_MENU_RENAME,0,"Rename");
  menu.add(0,D_MENU_COPY,0,"Copy");
  menu.add(0,D_MENU_MOVE,0,"Cut");
  menu.add(0,D_MENU_ZIP,0,"Zip");
  menu.add(0,D_MENU_PASTE,0,"Paste into folder").setEnabled(mHoldingFile);
  menu.add(0,D_MENU_UNZIP,0,"Unzip here").setEnabled(mHoldingZip);
  mActionModeSelected=true;
  return true;
}
 

Example 13

From project Android-Flashcards, under directory /src/com/secretsockssoftware/androidflashcards/.

Source file: AndroidFlashcards.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,GET_LESSONS_ID,0,R.string.get_lessons);
  menu.add(0,RESCAN_ID,1,R.string.rescan);
  menu.add(0,FEED_BACK_ID,1,R.string.feedback);
  return true;
}
 

Example 14

From project android-joedayz, under directory /Proyectos/Sudoku04/src/pe/joedayz/sudoku/.

Source file: Sudoku.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.menu,menu);
  return true;
}
 

Example 15

From project android-ocr, under directory /android/src/edu/sfsu/cs/orange/ocr/.

Source file: CaptureActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,SETTINGS_ID,0,"Settings").setIcon(android.R.drawable.ic_menu_preferences);
  menu.add(0,ABOUT_ID,0,"About").setIcon(android.R.drawable.ic_menu_info_details);
  return true;
}
 

Example 16

From project android-pedometer, under directory /src/name/bagi/levente/pedometer/.

Source file: Pedometer.java

  15 
vote

public boolean onPrepareOptionsMenu(Menu menu){
  menu.clear();
  if (mIsRunning) {
    menu.add(0,MENU_PAUSE,0,R.string.pause).setIcon(android.R.drawable.ic_media_pause).setShortcut('1','p');
  }
 else {
    menu.add(0,MENU_RESUME,0,R.string.resume).setIcon(android.R.drawable.ic_media_play).setShortcut('1','p');
  }
  menu.add(0,MENU_RESET,0,R.string.reset).setIcon(android.R.drawable.ic_menu_close_clear_cancel).setShortcut('2','r');
  menu.add(0,MENU_SETTINGS,0,R.string.settings).setIcon(android.R.drawable.ic_menu_preferences).setShortcut('8','s').setIntent(new Intent(this,Settings.class));
  menu.add(0,MENU_QUIT,0,R.string.quit).setIcon(android.R.drawable.ic_lock_power_off).setShortcut('9','q');
  return true;
}
 

Example 17

From project android-pulltorefresh, under directory /sample/src/com/handmark/pulltorefresh/samples/.

Source file: PullToRefreshListActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  menu.add(0,MENU_MANUAL_REFRESH,0,"Manual Refresh");
  menu.add(0,MENU_DISABLE_SCROLL,1,mPullRefreshListView.isDisableScrollingWhileRefreshing() ? "Enable Scrolling while Refreshing" : "Disable Scrolling while Refreshing");
  menu.add(0,MENU_SET_MODE,0,mPullRefreshListView.getMode() == Mode.BOTH ? "Change to MODE_PULL_DOWN" : "Change to MODE_PULL_BOTH");
  return super.onCreateOptionsMenu(menu);
}
 

Example 18

From project android-rackspacecloud, under directory /src/com/rackspacecloud/android/.

Source file: ContainerObjectDetails.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.container_object_list_menu,menu);
  return true;
}
 

Example 19

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/core/activity/.

Source file: TopLevelActivity.java

  15 
vote

@Override public boolean onPrepareOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  MenuItem item=menu.findItem(MenuUtils.SYNC_ID);
  if (item != null) {
    item.setVisible(Preferences.validateTracksSettings(this));
  }
  return true;
}
 

Example 20

From project Android-Terminal-Emulator, under directory /src/jackpal/androidterm/.

Source file: Term.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  getMenuInflater().inflate(R.menu.main,menu);
  MenuItemCompat.setShowAsAction(menu.findItem(R.id.menu_new_window),MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
  MenuItemCompat.setShowAsAction(menu.findItem(R.id.menu_close_window),MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
  return true;
}
 

Example 21

From project android-tether, under directory /src/og/android/tether/.

Source file: AccessControlActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  boolean supRetVal=super.onCreateOptionsMenu(menu);
  SubMenu refreshClientList=menu.addSubMenu(0,MENU_RELOAD_CLIENTS,0,getString(R.string.accesscontrol_activity_reloadclientlist));
  refreshClientList.setIcon(drawable.ic_menu_revert);
  SubMenu saveWhitelist=menu.addSubMenu(0,MENU_APPLY,0,getString(R.string.accesscontrol_activity_applysettings));
  saveWhitelist.setIcon(drawable.ic_menu_save);
  return supRetVal;
}
 

Example 22

From project android-voip-service, under directory /src/main/java/org/linphone/.

Source file: LinphoneActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.linphone_activity_menu,menu);
  menu.findItem(R.id.menu_settings).setVisible(useMenuSettings);
  menu.findItem(R.id.menu_about).setVisible(useMenuAbout);
  return true;
}
 

Example 23

From project android-vpn-settings, under directory /src/com/android/settings/vpn/.

Source file: VpnEditor.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_SAVE,0,R.string.vpn_menu_done).setIcon(android.R.drawable.ic_menu_save);
  menu.add(0,MENU_CANCEL,0,mAddingProfile ? R.string.vpn_menu_cancel : R.string.vpn_menu_revert).setIcon(android.R.drawable.ic_menu_close_clear_cancel);
  return true;
}
 

Example 24

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/activity/.

Source file: AbsListActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  menu.add(0,MENU_NOW_PLAYING,0,"Now playing").setIcon(R.drawable.menu_nowplaying);
  mListController.onCreateOptionsMenu(menu);
  menu.add(0,MENU_REMOTE,0,"Remote control").setIcon(R.drawable.menu_remote);
  return super.onCreateOptionsMenu(menu);
}
 

Example 25

From project android-xbmcremote-sandbox, under directory /src/org/xbmc/android/remotesandbox/ui/base/.

Source file: ActionBarActivity.java

  15 
vote

/** 
 * Base action bar-aware implementation for {@link Activity#onCreateOptionsMenu(android.view.Menu)}. Note: marking menu items as invisible/visible is not currently supported.
 */
@Override public boolean onCreateOptionsMenu(Menu menu){
  boolean retValue=false;
  retValue|=mActionBarHelper.onCreateOptionsMenu(menu);
  retValue|=super.onCreateOptionsMenu(menu);
  return retValue;
}
 

Example 26

From project AndroidDevWeekendDub-BookLibrary, under directory /src/org/curiouscreature/android/shelves/activity/.

Source file: ShelvesActivity.java

  15 
vote

@Override public boolean onPrepareOptionsMenu(Menu menu){
  final boolean scanAvailable=ScanIntent.isInstalled(this);
  MenuItem item;
  item=menu.findItem(R.id.menu_item_add);
  item.setEnabled(scanAvailable && (mAddTask == null || mAddTask.getStatus() == UserTask.Status.FINISHED));
  item=menu.findItem(R.id.menu_item_check);
  item.setEnabled(scanAvailable);
  return super.onPrepareOptionsMenu(menu);
}
 

Example 27

From project Android_1, under directory /PropagatedIntents/src/com/example/android/notepad/.

Source file: NoteEditor.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  if (mState == STATE_EDIT) {
    menu.add(0,REVERT_ID,0,R.string.menu_revert).setShortcut('0','r').setIcon(android.R.drawable.ic_menu_revert);
    if (!mNoteOnly) {
      menu.add(0,DELETE_ID,0,R.string.menu_delete).setShortcut('1','d').setIcon(android.R.drawable.ic_menu_delete);
    }
  }
 else {
    menu.add(0,DISCARD_ID,0,R.string.menu_discard).setShortcut('0','d').setIcon(android.R.drawable.ic_menu_delete);
  }
  if (!mNoteOnly) {
    Intent intent=new Intent(null,getIntent().getData());
    intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
    menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE,0,0,new ComponentName(this,NoteEditor.class),null,intent,0,null);
  }
  return true;
}
 

Example 28

From project android_5, under directory /src/aarddict/android/.

Source file: ArticleViewActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  miViewOnline=menu.add(0,MENU_VIEW_ONLINE,0,R.string.mnViewOnline).setIcon(android.R.drawable.ic_menu_view);
  menu.add(0,MENU_NEW_LOOKUP,0,R.string.mnNewLookup).setIcon(android.R.drawable.ic_menu_search);
  menu.add(0,MENU_ZOOM_OUT,0,R.string.mnZoomOut).setIcon(R.drawable.ic_menu_zoom_out);
  menu.add(0,MENU_ZOOM_IN,0,R.string.mnZoomIn).setIcon(R.drawable.ic_menu_zoom_in);
  return true;
}
 

Example 29

From project android_7, under directory /src/org/immopoly/android/app/.

Source file: ImmopolyActivity.java

  15 
vote

@Override public boolean onPrepareOptionsMenu(Menu menu){
  if (UserDataManager.instance.getState() == UserDataManager.USER_UNKNOWN) {
    menu.findItem(R.id.menu_logout).setTitle("Anmelden");
  }
 else {
    menu.findItem(R.id.menu_logout).setTitle("Abmelden");
  }
  return true;
}
 

Example 30

From project android_8, under directory /src/com/defuzeme/.

Source file: MainActivity.java

  15 
vote

@Override public boolean onPrepareOptionsMenu(Menu menu){
  menu.clear();
  final MenuInflater inflater=this.getMenuInflater();
  if (Gui._isConnected == true) {
    inflater.inflate(R.menu.main_activity_menu,menu);
  }
 else {
    inflater.inflate(R.menu.main_activity_menu_disconnected,menu);
  }
  return true;
}
 

Example 31

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/.

Source file: ApnEditor.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  if (!mNewApn) {
    menu.add(0,MENU_DELETE,0,R.string.menu_delete).setIcon(android.R.drawable.ic_menu_delete);
  }
  menu.add(0,MENU_SAVE,0,R.string.menu_save).setIcon(android.R.drawable.ic_menu_save);
  menu.add(0,MENU_CANCEL,0,R.string.menu_cancel).setIcon(android.R.drawable.ic_menu_close_clear_cancel);
  return true;
}
 

Example 32

From project android_packages_apps_FileManager, under directory /src/org/openintents/distribution/.

Source file: DistributionLibrary.java

  15 
vote

public void onCreateOptionsMenu(Menu menu){
  menu.removeItem(mFirstMenuId + OFFSET_UPDATE);
  menu.removeItem(mFirstMenuId + OFFSET_ABOUT);
  if (UpdateDialog.isUpdateMenuNecessary(mActivity)) {
    menu.add(0,mFirstMenuId + OFFSET_UPDATE,0,R.string.oi_distribution_menu_update).setIcon(android.R.drawable.ic_menu_info_details).setShortcut('9','u');
  }
  menu.add(0,mFirstMenuId + OFFSET_ABOUT,0,R.string.oi_distribution_about).setIcon(android.R.drawable.ic_menu_info_details).setShortcut('0','a');
}
 

Example 33

From project android_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: Camera.java

  15 
vote

@Override public boolean onPrepareOptionsMenu(Menu menu){
  super.onPrepareOptionsMenu(menu);
  for (int i=0; i < menu.size(); i++) {
    menu.getItem(i).setVisible(isCameraIdle());
  }
  return true;
}
 

Example 34

From project android_packages_apps_Gallery2, under directory /src/com/android/gallery3d/app/.

Source file: AlbumPage.java

  15 
vote

@Override protected boolean onCreateActionBar(Menu menu){
  Activity activity=(Activity)mActivity;
  GalleryActionBar actionBar=mActivity.getGalleryActionBar();
  MenuInflater inflater=activity.getMenuInflater();
  if (mGetContent) {
    inflater.inflate(R.menu.pickup,menu);
    int typeBits=mData.getInt(Gallery.KEY_TYPE_BITS,DataManager.INCLUDE_IMAGE);
    actionBar.setTitle(GalleryUtils.getSelectionModePrompt(typeBits));
  }
 else {
    inflater.inflate(R.menu.album,menu);
    actionBar.setTitle(mMediaSet.getName());
    if (mMediaSet instanceof MtpDevice) {
      menu.findItem(R.id.action_slideshow).setVisible(false);
    }
 else {
      menu.findItem(R.id.action_slideshow).setVisible(true);
    }
    FilterUtils.setupMenuItems(actionBar,mMediaSetPath,true);
    MenuItem groupBy=menu.findItem(R.id.action_group_by);
    if (groupBy != null) {
      groupBy.setVisible(mShowClusterMenu);
    }
    MenuItem switchCamera=menu.findItem(R.id.action_camera);
    if (switchCamera != null) {
      switchCamera.setVisible(MediaSetUtils.isCameraSource(mMediaSetPath) && GalleryUtils.isCameraAvailable(activity));
    }
    actionBar.setTitle(mMediaSet.getName());
  }
  actionBar.setSubtitle(null);
  return true;
}
 

Example 35

From project android_packages_apps_Gallery3D, under directory /src/com/cooliris/media/.

Source file: MovieView.java

  15 
vote

@Override public boolean onPrepareOptionsMenu(Menu menu){
  menu.clear();
  MenuItem item1=menu.add(0,MENU_OPEN_URL,0,R.string.menu_open_url);
  item1.setIcon(android.R.drawable.ic_menu_preferences);
  return true;
}
 

Example 36

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: EditFdnContactScreen.java

  15 
vote

/** 
 * Overridden to display the import and delete commands.
 */
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  Resources r=getResources();
  menu.add(0,MENU_IMPORT,0,r.getString(R.string.importToFDNfromContacts)).setIcon(R.drawable.ic_menu_contact);
  menu.add(0,MENU_DELETE,0,r.getString(R.string.menu_delete)).setIcon(android.R.drawable.ic_menu_delete);
  return true;
}
 

Example 37

From project android_packages_apps_QiblaCompass, under directory /src/com/farsitel/qiblacompass/activities/.

Source file: QiblaActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  int aboutGroupID=0;
  int prefsGroupID=2;
  int aboutItemOrder=2;
  int prefsItemOrder=Menu.FIRST;
  MenuItem aboutMenuItem=menu.add(aboutGroupID,MENU_ABOUT,aboutItemOrder,R.string.about_menu_title);
  aboutMenuItem.setIcon(R.drawable.about);
  MenuItem settingMenuItem=menu.add(prefsGroupID,MENU_PREFS,prefsItemOrder,R.string.prefs_menu_title);
  settingMenuItem.setIcon(R.drawable.settings);
  return true;
}
 

Example 38

From project android_packages_apps_QuickSearchBox, under directory /src/com/android/quicksearchbox/.

Source file: SearchSettings.java

  15 
vote

public static void addSearchSettingsMenuItem(Context context,Menu menu){
  Intent settings=new Intent(SearchManager.INTENT_ACTION_SEARCH_SETTINGS);
  settings.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
  settings.setPackage(context.getPackageName());
  menu.add(Menu.NONE,Menu.NONE,0,R.string.menu_settings).setIcon(R.drawable.ic_menu_preferences).setAlphabeticShortcut('P').setIntent(settings);
}
 

Example 39

From project android_packages_apps_Superuser, under directory /src/com/noshufou/android/su/.

Source file: AppDetailsFragment.java

  15 
vote

@Override public void onCreateOptionsMenu(Menu menu,MenuInflater inflater){
  if (!mReady)   return;
  menu.add(Menu.NONE,MenuId.TOGGLE,MenuId.TOGGLE,R.string.menu_toggle).setIcon(R.drawable.ic_action_toggle).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
  menu.add(Menu.NONE,MenuId.FORGET,MenuId.FORGET,R.string.menu_forget).setIcon(R.drawable.ic_action_delete).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
  menu.add(Menu.NONE,MenuId.CLEAR_LOG,MenuId.CLEAR_LOG,R.string.menu_clear_log).setIcon(R.drawable.ic_action_clear_log).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
  if (mElitePresent) {
    menu.add(Menu.NONE,MenuId.USE_APP_SETTINGS,MenuId.USE_APP_SETTINGS,R.string.use_global_settings).setCheckable(true).setChecked(mUseAppSettings).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    menu.add(MENU_GROUP_OPTIONS,MenuId.NOTIFICATIONS,MenuId.NOTIFICATIONS,R.string.notifications_enabled).setCheckable(true).setChecked(mNotificationsEnabled);
    menu.add(MENU_GROUP_OPTIONS,MenuId.LOGGING,MenuId.LOGGING,R.string.logging_enabled).setCheckable(true).setChecked(mLoggingEnabled);
    menu.setGroupEnabled(MENU_GROUP_OPTIONS,!mUseAppSettings);
  }
}
 

Example 40

From project andstatus, under directory /src/org/andstatus/app/.

Source file: TimelineActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.timeline,menu);
  Intent intent=new Intent(null,getIntent().getData());
  intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
  menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE,0,0,new ComponentName(this,TimelineActivity.class),null,intent,0,null);
  return true;
}
 

Example 41

From project andtweet, under directory /src/com/xorcode/andtweet/.

Source file: TimelineActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.timeline,menu);
  Intent intent=new Intent(null,getIntent().getData());
  intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
  menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE,0,0,new ComponentName(this,TweetListActivity.class),null,intent,0,null);
  return true;
}
 

Example 42

From project Anki-Android, under directory /src/com/ichi2/anki/.

Source file: Reviewer.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  MenuItem item;
  if (mPrefWhiteboard) {
    item=menu.add(Menu.NONE,MENU_WHITEBOARD,Menu.NONE,R.string.show_whiteboard);
    item.setIcon(R.drawable.ic_menu_compose);
    item=menu.add(Menu.NONE,MENU_CLEAR_WHITEBOARD,Menu.NONE,R.string.clear_whiteboard);
    item.setIcon(R.drawable.ic_menu_clear_playlist);
  }
  item=menu.add(Menu.NONE,MENU_EDIT,Menu.NONE,R.string.menu_edit_card);
  item.setIcon(android.R.drawable.ic_menu_edit);
  item=menu.add(Menu.NONE,MENU_SUSPEND,Menu.NONE,R.string.menu_suspend_card);
  item.setIcon(android.R.drawable.ic_menu_close_clear_cancel);
  if (mPrefTextSelection) {
    item=menu.add(Menu.NONE,MENU_SEARCH,Menu.NONE,R.string.menu_search);
    item.setIcon(R.drawable.ic_menu_search);
  }
  item=menu.add(Menu.NONE,MENU_MARK,Menu.NONE,R.string.menu_mark_card);
  return true;
}
 

Example 43

From project apg, under directory /src/org/thialfihar/android/apg/.

Source file: MainActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  menu.add(0,Id.menu.option.manage_public_keys,0,R.string.menu_managePublicKeys).setIcon(android.R.drawable.ic_menu_manage);
  menu.add(0,Id.menu.option.manage_secret_keys,1,R.string.menu_manageSecretKeys).setIcon(android.R.drawable.ic_menu_manage);
  menu.add(1,Id.menu.option.create,2,R.string.menu_addAccount).setIcon(android.R.drawable.ic_menu_add);
  menu.add(2,Id.menu.option.preferences,3,R.string.menu_preferences).setIcon(android.R.drawable.ic_menu_preferences);
  menu.add(2,Id.menu.option.key_server,4,R.string.menu_keyServer).setIcon(android.R.drawable.ic_menu_search);
  menu.add(3,Id.menu.option.about,5,R.string.menu_about).setIcon(android.R.drawable.ic_menu_info_details);
  menu.add(3,Id.menu.option.help,6,R.string.menu_help).setIcon(android.R.drawable.ic_menu_help);
  return true;
}
 

Example 44

From project apps-for-android, under directory /DivideAndConquer/src/com/google/android/divideandconquer/.

Source file: DivideAndConquerActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_NEW_GAME,MENU_NEW_GAME,"New Game");
  menu.add(0,MENU_SETTINGS,MENU_SETTINGS,"Settings");
  return true;
}
 

Example 45

From project badgescanner, under directory /src/net/tjohns/badgescanner/.

Source file: BaseActivity.java

  15 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.main,menu);
  return true;
}