List of usage examples for android.view MenuInflater inflate
public void inflate(@MenuRes int menuRes, Menu menu)
From source file:com.andrewshu.android.reddit.profile.ProfileActivity.java
/** * Populates the menu.//from w w w . j a va2 s. c o m */ @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.profile, menu); return true; }
From source file:com.wheelphone.remotemini.WheelphoneRemoteMini.java
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); return true;/*from w w w . j a v a 2s. c o m*/ }
From source file:sjizl.com.ChatActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.chat_menu_list, menu); }
From source file:com.krayzk9s.imgurholo.ui.SingleImageFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { ImgurHoloActivity activity = (ImgurHoloActivity) getActivity(); if (activity.getApiCall().settings.getString("theme", MainActivity.HOLO_LIGHT) .equals(MainActivity.HOLO_LIGHT)) inflater.inflate(R.menu.main, menu); else//from w ww. ja v a2 s.com inflater.inflate(R.menu.main_dark, menu); if (imageData.getJSONObject().has("deletehash")) { menu.findItem(R.id.action_delete).setVisible(true); menu.findItem(R.id.action_edit).setVisible(true); menu.findItem(R.id.action_submit).setVisible(true); } menu.findItem(R.id.action_share).setVisible(true); menu.findItem(R.id.action_download).setVisible(true); menu.findItem(R.id.action_copy).setVisible(true); menu.findItem(R.id.action_refresh).setVisible(true); menu.findItem(R.id.action_upload).setVisible(false); menu.findItem(R.id.action_sort).setVisible(true); menu.findItem(R.id.action_sort).getSubMenu().findItem(R.id.menuSortNewest).setVisible(true); menu.findItem(R.id.action_sort).getSubMenu().findItem(R.id.menuSortBest).setVisible(true); menu.findItem(R.id.action_sort).getSubMenu().findItem(R.id.menuSortPopularity).setVisible(false); }
From source file:in.shick.diode.user.ProfileActivity.java
/** * Populates the menu./*from www . j a v a 2s. c o m*/ */ @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.profile, menu); hideShowMenuItems(menu); return true; }
From source file:fiskinfoo.no.sintef.fiskinfoo.MyToolsFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { for (int i = 0; i < menu.size(); i++) { menu.removeItem(i);//from w ww .ja v a 2 s. com } inflater.inflate(R.menu.menu_tool_registration, menu); }
From source file:no.ntnu.idi.socialhitchhiking.map.MapActivityCreateOrEditRoute.java
@Override /**//from w ww. ja v a2 s.c o m * Creates a menu from the xml_mapmenu.xml file. * */ public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.xml_mapmenu, menu); return super.onCreateOptionsMenu(menu); }
From source file:ca.mudar.mtlaucasou.BaseMapFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { /**/*from w w w . j av a 2 s . c o m*/ * Manual detection of Android version: This is because of a * ActionBarSherlock/compatibility package issue with the MenuInflater. * Also, versions earlier than Honeycomb don't manage SHOW_AS_ACTION_* * options other than ALWAYS. */ if (Const.SUPPORTS_HONEYCOMB) { /** * Honeycomb drawables are different (white instead of grey) because * the items are in the actionbar. Order is: toggle (1), kml (2), * list sort (3), postal code (4), my position (5). */ menu.add(Menu.NONE, R.id.menu_map_find_from_name, 4, R.string.menu_map_find_from_name) .setIcon(getResources().getDrawable(R.drawable.ic_actionbar_search)); menu.add(Menu.NONE, R.id.menu_map_mylocation, 5, R.string.menu_map_mylocation) .setIcon(getResources().getDrawable(R.drawable.ic_actionbar_mylocation)); } else { inflater.inflate(R.menu.menu_fragment_map, menu); } /** * Disable the My Location button if the user location is not known yet. */ if (((AppHelper) getSupportActivity().getApplicationContext()).getLocation() == null) { menu.findItem(R.id.menu_map_mylocation).setEnabled(false); } }
From source file:com.android.contacts.activities.PeopleActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { if (!areContactsAvailable()) { // If contacts aren't available, hide all menu items. return false; }//from ww w . j a v a2 s . c om super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.people_options, menu); return true; }