Java Code Examples for android.view.MenuInflater

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 abalone-android, under directory /src/com/bytopia/abalone/.

Source file: MainMenuActivity.java

  18 
vote

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

Example 2

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

Source file: Demo.java

  18 
vote

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

Example 3

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

Source file: ContactsClient.java

  18 
vote

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

Example 4

From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/download/.

Source file: Download.java

  18 
vote

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

Example 5

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

Source file: MainActivity.java

  18 
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 6

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

Source file: AtmaSelector.java

  18 
vote

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

Example 7

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

Source file: Sudoku.java

  18 
vote

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

Example 8

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

Source file: ContainerObjectDetails.java

  18 
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 9

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

Source file: LinphoneActivity.java

  18 
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 10

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

Source file: MainActivity.java

  18 
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 11

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

Source file: PhotoPage.java

  18 
vote

@Override protected boolean onCreateActionBar(Menu menu){
  MenuInflater inflater=((Activity)mActivity).getMenuInflater();
  inflater.inflate(R.menu.photo,menu);
  mShareActionProvider=GalleryActionBar.initializeShareActionProvider(menu);
  if (mPendingSharePath != null)   updateShareURI(mPendingSharePath);
  mMenu=menu;
  updateMenuOperations();
  updateTitle();
  return true;
}
 

Example 12

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

Source file: TimelineActivity.java

  18 
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 13

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

Source file: TimelineActivity.java

  18 
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 14

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

Source file: BaseActivity.java

  18 
vote

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

Example 15

From project BART, under directory /src/pro/dbro/bart/.

Source file: TheActivity.java

  18 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  if (Build.VERSION.SDK_INT < 11) {
    MenuItem mi=menu.add(0,0,0,"About");
    mi.setIcon(R.drawable.about);
  }
 else {
    MenuInflater inflater=getMenuInflater();
    inflater.inflate(R.layout.actionitem,menu);
  }
  return super.onCreateOptionsMenu(menu);
}
 

Example 16

From project BombusLime, under directory /src/org/bombusim/lime/fragments/.

Source file: ChatFragment.java

  18 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  menu.setHeaderTitle(R.string.messageMenuTitle);
  MenuInflater inflater=getActivity().getMenuInflater();
  inflater.inflate(R.menu.message_menu,menu);
}
 

Example 17

From project Catroid-maven-playground, under directory /src/main/java/at/tugraz/ist/catroid/ui/.

Source file: ScriptActivity.java

  18 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  if (view.getId() == R.id.brick_list_view) {
    menu.setHeaderTitle(R.string.script_context_menu_title);
    if (adapter.getItem(listView.getTouchedListPosition()) instanceof Script) {
      scriptToEdit=(Script)adapter.getItem(listView.getTouchedListPosition());
      MenuInflater inflater=getMenuInflater();
      inflater.inflate(R.menu.script_menu,menu);
    }
  }
}
 

Example 18

From project cmsandroid, under directory /src/com/zia/freshdocs/activity/.

Source file: HostsActivity.java

  18 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  HostAdapter adapter=(HostAdapter)getListAdapter();
  CMISHost host=adapter.getItem(((AdapterContextMenuInfo)menuInfo).position);
  if (!host.getId().equals(Constants.NEW_HOST_ID)) {
    MenuInflater inflater=getMenuInflater();
    inflater.inflate(R.menu.host_context_menu,menu);
  }
}
 

Example 19

From project CoinFlip, under directory /src/com/banasiak/coinflip/.

Source file: CoinFlip.java

  18 
vote

/** 
 * Called when the user presses the menu button.
 */
@Override public boolean onCreateOptionsMenu(final Menu menu){
  Log.d(TAG,"onCreateOptionsMenu()");
  super.onCreateOptionsMenu(menu);
  final MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.menu,menu);
  return true;
}
 

Example 20

From project cw-advandroid, under directory /Honeycomb/ActionMode/src/com/commonsware/android/actionmode/.

Source file: ActionModeHelper.java

  18 
vote

@Override public boolean onCreateActionMode(ActionMode mode,Menu menu){
  MenuInflater inflater=host.getMenuInflater();
  inflater.inflate(R.menu.context,menu);
  mode.setTitle(R.string.context_title);
  return (true);
}
 

Example 21

From project cw-omnibus, under directory /ActionMode/ActionModeMC/src/com/commonsware/android/actionmodemc/.

Source file: HCMultiChoiceModeListener.java

  18 
vote

@Override public boolean onCreateActionMode(ActionMode mode,Menu menu){
  MenuInflater inflater=host.getMenuInflater();
  inflater.inflate(R.menu.context,menu);
  mode.setTitle(R.string.context_title);
  mode.setSubtitle("(1)");
  activeMode=mode;
  return (true);
}
 

Example 22

From project cwac-richedit, under directory /src/com/commonsware/cwac/richedit/.

Source file: EditorActionModeCallback.java

  18 
vote

@Override public boolean onCreateActionMode(ActionMode mode,Menu menu){
  MenuInflater inflater=mode.getMenuInflater();
  inflater.inflate(menuResource,menu);
  listener.setIsShowing(true);
  return (true);
}
 

Example 23

From project DeliciousDroid, under directory /src/com/deliciousdroid/activity/.

Source file: AddBookmark.java

  18 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  boolean result=super.onCreateOptionsMenu(menu);
  MenuInflater inflater=getMenuInflater();
  if (result && isMyself()) {
    inflater.inflate(R.menu.add_bookmark_menu,menu);
  }
  return result;
}
 

Example 24

From project DigitbooksExamples, under directory /DigitbooksExamples/src/fr/digitbooks/android/examples/chapitre05/.

Source file: MenuXmlActivity.java

  18 
vote

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

Example 25

From project Diktofon, under directory /app/src/kaljurand_at_gmail_dot_com/diktofon/activity/.

Source file: RecordingListActivity.java

  18 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.cm_notes,menu);
  final AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  final Recording note=(Recording)mListView.getItemAtPosition(info.position);
  if (!note.needsTrans()) {
    MenuItem menuItem=menu.findItem(R.id.cm_notes_transcribe);
    menuItem.setEnabled(false);
  }
}
 

Example 26

From project DownloadProvider, under directory /src/com/mozillaonline/providers/downloads/ui/.

Source file: DownloadList.java

  18 
vote

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

Example 27

From project droidgiro-android, under directory /src/se/droidgiro/.

Source file: PairingActivity.java

  18 
vote

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

Example 28

From project FileExplorer, under directory /src/net/micode/fileexplorer/.

Source file: FileListItem.java

  18 
vote

@Override public boolean onCreateActionMode(ActionMode mode,Menu menu){
  MenuInflater inflater=((Activity)mContext).getMenuInflater();
  mMenu=menu;
  inflater.inflate(R.menu.operation_menu,mMenu);
  initMenuItemSelectAllOrCancel();
  return true;
}
 

Example 29

From project filemanager, under directory /FileManager/src/org/openintents/filemanager/.

Source file: FileManagerActivity.java

  18 
vote

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

Example 30

From project gmarks-android, under directory /src/main/java/org/thomnichols/android/gmarks/.

Source file: BookmarksListActivity.java

  18 
vote

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

Example 31

From project Gmote, under directory /gmoteclient/src/org/gmote/client/android/.

Source file: ActivityUtil.java

  18 
vote

public boolean onCreateOptionsMenu(Menu menu){
  mMenu=menu;
  MenuInflater inflater=mActivity.getMenuInflater();
  inflater.inflate(R.menu.control,menu);
  return true;
}
 

Example 32

From project HarleyDroid, under directory /src/org/harleydroid/.

Source file: HarleyDroidDashboard.java

  18 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  if (D)   Log.d(TAG,"onCreateOptionsMenu()");
  super.onCreateOptionsMenu(menu);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.dashboard_menu,menu);
  return true;
}
 

Example 33

From project imgur-Uploader, under directory /src/com/maass/android/imgur_uploader/.

Source file: History.java

  18 
vote

/** 
 * Setup menu (non-Javadoc)
 * @see android.app.Activity#onCreateOptionsMenu(android.view.Menu)
 */
@Override public boolean onCreateOptionsMenu(final Menu menu){
  final MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.options_menu,menu);
  menu.findItem(R.id.AboutMenu).setIntent(new Intent(this,LaunchedInfo.class));
  menu.findItem(R.id.SettingsMenu).setIntent(new Intent(this,ImgurPreferences.class));
  return true;
}
 

Example 34

From project iosched_3, under directory /android/src/com/google/android/apps/iosched/ui/.

Source file: MyScheduleFragment.java

  18 
vote

@Override public boolean onCreateActionMode(ActionMode mode,Menu menu){
  MenuInflater inflater=mode.getMenuInflater();
  inflater.inflate(R.menu.sessions_context,menu);
  MenuItem starMenuItem=menu.findItem(R.id.menu_star);
  starMenuItem.setTitle(R.string.description_remove_schedule);
  starMenuItem.setIcon(R.drawable.ic_action_remove_schedule);
  return true;
}
 

Example 35

From project jamendo-android, under directory /src/com/teleca/jamendo/activity/.

Source file: DownloadActivity.java

  18 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  if (v.getId() == R.id.DownloadListView) {
    MenuInflater inflater=getMenuInflater();
    inflater.inflate(R.menu.download_context,menu);
  }
}
 

Example 36

From project javaee-tutorial, under directory /jaxrs/android/src/org/jboss/ee/tutorial/jaxrs/android/.

Source file: LibraryListActivity.java

  18 
vote

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

Example 37

From project keepassdroid, under directory /src/com/keepassdroid/.

Source file: EntryEditActivity.java

  18 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.entry_edit,menu);
  MenuItem togglePassword=menu.findItem(R.id.menu_toggle_pass);
  if (mShowPassword) {
    togglePassword.setTitle(R.string.menu_hide_password);
  }
 else {
    togglePassword.setTitle(R.string.show_password);
  }
  return true;
}
 

Example 38

From project lastfm-android, under directory /app/src/fm/last/android/activity/.

Source file: Metadata.java

  18 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.player,menu);
  MenuItem changeView=menu.findItem(R.id.info_menu_item);
  changeView.setTitle(getString(R.string.action_nowplaying));
  changeView.setIcon(R.drawable.view_artwork);
  return super.onCreateOptionsMenu(menu);
}
 

Example 39

From project LoL-Chat, under directory /src/com/rei/lolchat/ui/.

Source file: Chat.java

  18 
vote

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

Example 40

From project maven-android-plugin-samples, under directory /apidemos-android-10/application/src/main/java/com/example/android/apis/app/.

Source file: MenuInflateFromXml.java

  18 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  mMenu=menu;
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(sMenuExampleResources[mSpinner.getSelectedItemPosition()],menu);
  mSpinner.setEnabled(false);
  mInstructionsText.setText(getResources().getString(R.string.menu_from_xml_instructions_go_back));
  return true;
}
 

Example 41

From project MicDroid, under directory /src/com/intervigil/micdroid/.

Source file: Mic.java

  18 
vote

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

Example 42

From project mobilis, under directory /MobilisXHunt/MobilisXHunt_Android/src/de/tudresden/inf/rn/mobilis/android/xhunt/activity/.

Source file: XHuntMapActivity.java

  18 
vote

public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.context_map,menu);
  menu.setHeaderIcon(R.drawable.station_50px);
  menu.setHeaderTitle(tappedReachableStation.getName());
  if (mGame.getCurrentRound() > 0) {
    menu.findItem(R.id.menu_context_map_target).setVisible(true);
  }
}
 

Example 43

From project mp3tunes-android, under directory /src/com/mp3tunes/android/activity/.

Source file: AlbumBrowser.java

  18 
vote

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

Example 44

From project NotePad, under directory /src/com/nononsenseapps/notepad/.

Source file: NotesListFragment.java

  18 
vote

@Override public boolean onCreateActionMode(android.view.ActionMode mode,android.view.Menu menu){
  Log.d("MODALMAN","onCreateActionMode mode: " + mode);
  this.textToShare.clear();
  this.notesToDelete.clear();
  MenuInflater inflater=activity.getMenuInflater();
  inflater.inflate(R.menu.list_select_menu,menu);
  this.mode=mode;
  return true;
}
 

Example 45

From project OpenBike, under directory /src/fr/openbike/android/ui/.

Source file: StationDetails.java

  18 
vote

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

Example 46

From project OpenTripPlanner-for-Android, under directory /src/org/opentripplanner/android/.

Source file: MainActivity.java

  18 
vote

@Override public boolean onCreateOptionsMenu(final Menu pMenu){
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.menu,pMenu);
  mGPS=pMenu.getItem(0);
  return true;
}
 

Example 47

From project packages_apps_BlackICEControl, under directory /src/com/blackice/control/.

Source file: ControlActivity.java

  18 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.main_activity,menu);
  MenuItem locale=menu.findItem(R.id.change_locale);
  if (Locale.getDefault().getLanguage().equals(Locale.ENGLISH.getLanguage())) {
    menu.removeItem(R.id.change_locale);
  }
 else {
    Configuration config=getBaseContext().getResources().getConfiguration();
    locale.setTitle("Locale (" + config.locale.getDisplayLanguage() + ")");
  }
  return true;
}
 

Example 48

From project packages_apps_Calendar, under directory /src/com/android/calendar/.

Source file: CalendarSettingsActivity.java

  18 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.settings_title_bar,menu);
  getActionBar().setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP,ActionBar.DISPLAY_HOME_AS_UP);
  return true;
}
 

Example 49

From project packages_apps_ROMControl, under directory /src/com/aokp/romcontrol/.

Source file: ROMControlActivity.java

  18 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.main_activity,menu);
  MenuItem locale=menu.findItem(R.id.change_locale);
  if (Locale.getDefault().getLanguage().equals(Locale.ENGLISH.getLanguage())) {
    menu.removeItem(R.id.change_locale);
  }
 else {
    Configuration config=getBaseContext().getResources().getConfiguration();
    locale.setTitle("Locale (" + config.locale.getDisplayLanguage() + ")");
  }
  return true;
}
 

Example 50

From project PinDroid, under directory /src/com/pindroid/activity/.

Source file: BrowseBookmarks.java

  18 
vote

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

Example 51

From project platform_packages_apps_browser, under directory /src/com/android/browser/.

Source file: BrowserSnapshotPage.java

  18 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  MenuInflater inflater=getActivity().getMenuInflater();
  inflater.inflate(R.menu.snapshots_context,menu);
  BookmarkItem header=new BookmarkItem(getActivity());
  header.setEnableScrolling(true);
  AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  populateBookmarkItem(mAdapter.getItem(info.position),header);
  menu.setHeaderView(header);
}
 

Example 52

From project platform_packages_apps_contacts, under directory /src/com/android/contacts/activities/.

Source file: ContactSelectionActivity.java

  18 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  if (shouldShowCreateNewContactButton() && mCreateNewContactButton == null) {
    MenuInflater inflater=getMenuInflater();
    inflater.inflate(R.menu.contact_picker_options,menu);
  }
  return true;
}
 

Example 53

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

Source file: PhotoPage.java

  18 
vote

@Override protected boolean onCreateActionBar(Menu menu){
  MenuInflater inflater=((Activity)mActivity).getMenuInflater();
  inflater.inflate(R.menu.photo,menu);
  mShareActionProvider=GalleryActionBar.initializeShareActionProvider(menu);
  if (mPendingSharePath != null)   updateShareURI(mPendingSharePath);
  mMenu=menu;
  mShowBars=true;
  updateMenuOperations();
  return true;
}
 

Example 54

From project platform_packages_apps_im, under directory /src/com/android/im/app/.

Source file: ContactListActivity.java

  18 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.contact_list_menu,menu);
  BrandingResources brandingRes=mApp.getBrandingResource(mProviderId);
  menu.findItem(R.id.menu_invite_user).setTitle(brandingRes.getString(BrandingResourceIDs.STRING_MENU_ADD_CONTACT));
  return true;
}
 

Example 55

From project platform_packages_apps_mms, under directory /src/com/android/mms/ui/.

Source file: ConversationList.java

  18 
vote

@Override public boolean onCreateActionMode(ActionMode mode,Menu menu){
  MenuInflater inflater=getMenuInflater();
  mSelectedThreadIds=new HashSet<Long>();
  inflater.inflate(R.menu.conversation_multi_select_menu,menu);
  if (mMultiSelectActionBarView == null) {
    mMultiSelectActionBarView=LayoutInflater.from(ConversationList.this).inflate(R.layout.conversation_list_multi_select_actionbar,null);
    mSelectedConvCount=(TextView)mMultiSelectActionBarView.findViewById(R.id.selected_conv_count);
  }
  mode.setCustomView(mMultiSelectActionBarView);
  ((TextView)mMultiSelectActionBarView.findViewById(R.id.title)).setText(R.string.select_conversations);
  return true;
}
 

Example 56

From project platform_packages_providers_downloadprovider, under directory /ui/src/com/android/providers/downloads/ui/.

Source file: DownloadList.java

  18 
vote

@Override public boolean onCreateActionMode(ActionMode mode,Menu menu){
  if (mDownloadList.haveCursors()) {
    final MenuInflater inflater=mDownloadList.getMenuInflater();
    inflater.inflate(R.menu.download_menu,menu);
  }
  mDownloadList.mActionMode=mode;
  return true;
}
 

Example 57

From project PomoTodo, under directory /pomotodo/src/net/juancarlosfernandez/pomotodo/view/.

Source file: Main.java

  18 
vote

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

Example 58

From project ActionBarCompat, under directory /ActionBarCompatSample/src/sk/m217/actionbarcompatsample/.

Source file: ActionBarCompatSampleActivity.java

  17 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  MenuInflater menuInflater=getMenuInflater();
  menuInflater.inflate(R.menu.options,menu);
  if (mMenu != null) {
    return super.onCreateOptionsMenu(menu);
  }
  mMenu=menu;
  MenuItem item=mMenu.findItem(R.id.menu_search);
  if (item != null) {
    MenuItemCompat.setOnActionExpandListener(item,new MenuItemCompat.OnActionExpandListenerCompat(){
      @Override public boolean onMenuItemActionExpand(      MenuItem item){
        Toast.makeText(ActionBarCompatSampleActivity.this,"onMenuItemActionExpand()",Toast.LENGTH_SHORT).show();
        return true;
      }
      @Override public boolean onMenuItemActionCollapse(      MenuItem item){
        Toast.makeText(ActionBarCompatSampleActivity.this,"onMenuItemActionCollapse()",Toast.LENGTH_SHORT).show();
        return true;
      }
    }
);
  }
  EditText editText=(EditText)MenuItemCompat.getActionView(item);
  if (editText != null) {
    editText.setText(R.string.menu_search);
  }
  item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
    @Override public boolean onMenuItemClick(    MenuItem item){
      Toast.makeText(ActionBarCompatSampleActivity.this,"onMenuItemClick()",Toast.LENGTH_LONG).show();
      return false;
    }
  }
);
  item.setIcon(R.drawable.ic_action_search).setTitle(R.string.menu_search).setIntent(null).setVisible(true).setEnabled(true);
  return super.onCreateOptionsMenu(menu);
}
 

Example 59

From project android_packages_apps_Tag, under directory /src/com/android/apps/tag/.

Source file: MyTagList.java

  17 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo info){
  Cursor cursor=mAdapter.getCursor();
  if (cursor == null || cursor.isClosed() || !cursor.moveToPosition(((AdapterContextMenuInfo)info).position)) {
    return;
  }
  menu.setHeaderTitle(cursor.getString(TagQuery.COLUMN_TITLE));
  long id=cursor.getLong(TagQuery.COLUMN_ID);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.my_tag_list_context_menu,menu);
  menu.findItem(R.id.set_as_active).setVisible(id != mActiveTagId);
  mTagIdLongPressed=id;
  if (mWriteSupport) {
    menu.add(0,1,0,"Write to tag");
  }
}
 

Example 60

From project cw-android, under directory /Menus/ActionBar/src/com/commonsware/android/actionbar/.

Source file: InflationDemo.java

  17 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  new MenuInflater(this).inflate(R.menu.option,menu);
  EditText add=(EditText)menu.findItem(R.id.add).getActionView().findViewById(R.id.title);
  add.setOnEditorActionListener(onSearch);
  return (super.onCreateOptionsMenu(menu));
}
 

Example 61

From project K6nele, under directory /app/src/ee/ioc/phon/android/speak/.

Source file: AppListActivity.java

  17 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.cm_app,menu);
  final AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  Cursor c=(Cursor)getListView().getItemAtPosition(info.position);
  long grammarId=c.getLong(c.getColumnIndex(App.Columns.GRAMMAR));
  long serverId=c.getLong(c.getColumnIndex(App.Columns.SERVER));
  if (grammarId == 0) {
    menu.findItem(R.id.cmAppRemoveGrammar).setEnabled(false);
  }
  if (serverId == 0) {
    menu.findItem(R.id.cmAppRemoveServer).setEnabled(false);
  }
}
 

Example 62

From project Locast-Android, under directory /src/edu/mit/mobile/android/locast/casts/.

Source file: CastListActivity.java

  17 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  final ClassCastException e) {
    Log.e(TAG,"bad menuInfo",e);
    return;
  }
  final Cursor c=(Cursor)getListAdapter().getItem(info.position);
  if (c == null) {
    return;
  }
  final MenuInflater menuInflater=getMenuInflater();
  menuInflater.inflate(R.menu.cast_context,menu);
  menuInflater.inflate(R.menu.cast_options,menu);
  menu.setHeaderTitle(c.getString(c.getColumnIndex(Cast._TITLE)));
  final boolean canEdit=Cast.canEdit(this,c);
  menu.findItem(R.id.cast_edit).setVisible(canEdit);
  menu.findItem(R.id.cast_delete).setVisible(canEdit);
}
 

Example 63

From project Memo, under directory /src/com/ngarside/memo/.

Source file: MapViewActivity.java

  17 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.insert,menu);
  SearchView searchView=(SearchView)menu.findItem(R.id.menu_search).getActionView();
  searchView.setOnQueryTextListener(new OnQueryTextListener(){
    public boolean onQueryTextChange(    String text){
      return false;
    }
    public boolean onQueryTextSubmit(    String text){
      Geocoder geo=new Geocoder(getApplicationContext());
      try {
        List<Address> add=geo.getFromLocationName(text,1);
        if (add.size() > 0) {
          GeoPoint point=new GeoPoint((int)(add.get(0).getLatitude() * 1000000),(int)(add.get(0).getLongitude() * 1000000));
          myMapController.animateTo(point);
          myMapController.setZoom(20);
        }
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
      return false;
    }
  }
);
  return true;
}
 

Example 64

From project androidTileMapEditor_1, under directory /src/it/sineo/android/tileMapEditor/.

Source file: TiledMapActivity.java

  15 
vote

public boolean onCreateOptionsMenu(Menu menu){
  com.actionbarsherlock.view.MenuInflater inflater=getSupportMenuInflater();
  inflater.inflate(R.menu.tiledmap,menu);
  menu.findItem(R.id.tiledMap_menu_save).setEnabled(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED));
  return true;
}
 

Example 65

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 66

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

Source file: AccessibilitySettings.java

  15 
vote

@Override public void onCreateOptionsMenu(Menu menu,MenuInflater inflater){
  super.onCreateOptionsMenu(menu,inflater);
  MenuItem menuItem=menu.add(mSettingsTitle);
  menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
  menuItem.setIntent(mSettingsIntent);
}
 

Example 67

From project dungbeetle, under directory /src/edu/stanford/mobisocial/dungbeetle/ui/fragments/.

Source file: FeedActionsFragment.java

  15 
vote

@Override public void onCreateOptionsMenu(Menu menu,MenuInflater inflater){
  MenuItem item;
  int placement=0;
  Log.d(TAG,"creating menu " + mDualPane);
  if (mDualPane || MusubiBaseActivity.isDeveloperModeEnabled(getActivity())) {
    item=menu.add(0,MENU_VIEW,placement++,"View");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }
  }
  item=menu.add(0,MENU_SHARE,placement++,"Share");
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
  }
}
 

Example 68

From project gddsched2, under directory /trunk/android/src/com/google/android/apps/iosched2/ui/.

Source file: VendorDetailFragment.java

  15 
vote

@Override public void onCreateOptionsMenu(Menu menu,MenuInflater inflater){
  if (!Setup.FEATURE_MAP_ON) {
    inflater.inflate(R.menu.map_menu_items,menu);
  }
  super.onCreateOptionsMenu(menu,inflater);
}
 

Example 69

From project platform_frameworks_support, under directory /v4/java/android/support/v4/app/.

Source file: FragmentManager.java

  15 
vote

public boolean dispatchCreateOptionsMenu(Menu menu,MenuInflater inflater){
  boolean show=false;
  ArrayList<Fragment> newMenus=null;
  if (mAdded != null) {
    for (int i=0; i < mAdded.size(); i++) {
      Fragment f=mAdded.get(i);
      if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible) {
        show=true;
        f.onCreateOptionsMenu(menu,inflater);
        if (newMenus == null) {
          newMenus=new ArrayList<Fragment>();
        }
        newMenus.add(f);
      }
    }
  }
  if (mCreatedMenus != null) {
    for (int i=0; i < mCreatedMenus.size(); i++) {
      Fragment f=mCreatedMenus.get(i);
      if (newMenus == null || !newMenus.contains(f)) {
        f.onDestroyOptionsMenu();
      }
    }
  }
  mCreatedMenus=newMenus;
  return show;
}
 

Example 70

From project platform_packages_apps_calendar, under directory /src/com/android/calendar/event/.

Source file: EditEventFragment.java

  15 
vote

@Override public void onCreateOptionsMenu(Menu menu,MenuInflater inflater){
  super.onCreateOptionsMenu(menu,inflater);
  if (!mUseCustomActionBar) {
    inflater.inflate(R.menu.edit_event_title_bar,menu);
  }
}
 

Example 71

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

Source file: AccessibilitySettings.java

  15 
vote

@Override public void onCreateOptionsMenu(Menu menu,MenuInflater inflater){
  super.onCreateOptionsMenu(menu,inflater);
  MenuItem menuItem=menu.add(mSettingsTitle);
  menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
  menuItem.setIntent(mSettingsIntent);
}