android-optionsmenu

Options menu not showing in ICS using compatibility library

南楼画角 提交于 2019-12-01 02:12:02
I can't get an options menu to show in a Fragment in ICS in a project which uses the android-support-v4.jar library. I'm testing on a Galaxy Nexus handset. We aren't using the action bar, and need the app to be 2.2+ compatible. We aren't seeing any options menu in the activity in ICS (the FragmentActivity doesn't support onCreateOptionsMenu) I can get menus working in previous version of Android - I have all the correct framework to enable the options menu (as below) but nothing shows in ICS. When stepping through the code the onCreateOptionsMenu doesn't get called. Can anyone suggest a fix?

Using Android action bar share intent

雨燕双飞 提交于 2019-12-01 00:58:47
I'm using a menu item on the action bar and I want to share my app by clicking the share icon. When I click the share icon it doesn't work. Also, I want to add text saying "install this app" when shared. Here is my code: private ShareActionProvider mShareActionProvider; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.mainpage, menu); MenuItem item = menu.findItem(R.id.menu_item_share); mShareActionProvider = (ShareActionProvider) item.getActionProvider(); return true; } private

Re-using Options menu code

我们两清 提交于 2019-11-30 05:14:10
问题 Is there a convenient way of showing the same Options menu options in multiple Activities? Example: In my app, I display a TV Guide in one of three ways. Seven day guide (TabActivity with 7 tabs) All channels 'Now showing' (ListActivity) All shows today by start time (Activity - could be changed easily to ListActivity) For the Options menu in the TabActivity , the code is quite simple... @Override public boolean onPrepareOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); menu

OptionsMenu of Fragments in Viewpager showing each other's Buttons

北慕城南 提交于 2019-11-30 03:59:48
I've got three fragments in a viewpager. Two of these fragments have their own version of the onCreateOptionsMenu method: @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); // Set up 1 action button inflater.inflate(R.menu.home_snapshot_add, menu); } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); // Set up 2 action buttons inflater.inflate(R.menu.home_snapshot_send, menu); } The home activity has a basic onCreateOptionsMenu method: @Override public

onCreateOptionsMenu() calling super

烈酒焚心 提交于 2019-11-29 21:20:45
I'm creating application with OptionsMenu . I found few examples with it, but everyone is using different place where to call super.onCreateOptionMenu() in onCreateOptionsMenu() method. List of different ways: @Override // without super public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.mymenu, menu); return true; } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.mymenu, menu); return true; } @Override public boolean

Warning when canceling ActionBar Overflow menu on Android 4.1.x

穿精又带淫゛_ 提交于 2019-11-29 02:16:52
问题 This is the warning I'm getting: 03-02 14:38:43.980: W/InputEventReceiver(3961): Attempted to finish an input event but the input event receiver has already been disposed. The menu I have was generated from a regular res/menu/activity_menu.xml file. I'm handling the events exactly as detailed on http://developer.android.com/guide/topics/ui/menus.html#options-menu When I click the vertical three dots to open the overflow menu and cancel out of it, I get that warning. There seems to be little

OptionsMenu of Fragments in Viewpager showing each other's Buttons

浪子不回头ぞ 提交于 2019-11-29 01:13:46
问题 I've got three fragments in a viewpager. Two of these fragments have their own version of the onCreateOptionsMenu method: @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); // Set up 1 action button inflater.inflate(R.menu.home_snapshot_add, menu); } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); // Set up 2 action buttons inflater.inflate(R.menu.home

onCreateOptionsMenu() calling super

不问归期 提交于 2019-11-28 18:51:42
问题 I'm creating application with OptionsMenu . I found few examples with it, but everyone is using different place where to call super.onCreateOptionMenu() in onCreateOptionsMenu() method. List of different ways: @Override // without super public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.mymenu, menu); return true; } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater =

Pressing menu button causes crash in Activity with no ActionBar

北战南征 提交于 2019-11-28 06:54:25
I'm a newbie in Android and working on my first app. I have the main activity with no ActionBar in it. And I don't want to display any menu in that Activity . Everything is working just fine But when I press the menu button present in the device itself, it causes my app to force close instead of just ignoring it. I'm developing for sdk >=8 so I'm using the support library. I have tried adding OnCreateOptionMenu() in the code with nothing in it but ended up with same results. The name of my app is GUI and the package is gui. Here is the Logcat: 10-09 19:52:32.920: E/AndroidRuntime(7440): FATAL

Hide MenuItem in some Fragments

≯℡__Kan透↙ 提交于 2019-11-28 04:50:16
I using menu drawer which has more Fragment s. In some Fragment s I have menu item REFRESH but in some fragments I want hide this menu item (I don't want show menu but I don't want hide ActionBar ). I try add override onCreateOptionsMenu() to Fragment where I don't want show this menu item but I can not get it to work. I try many way see commented line in code. Does any idea where is problem? And last this menu item go to hide when I activate menu drawer when is called onPrepareOptionsMenu() in MainActivity but I need do this when I'm in Fragment . Fragment where I want hide menu item REFRESH: