Questions tagged [options-menu]

108 questions
145
votes
6 answers

Handling a Menu Item Click Event - Android

I want to create an intent that starts a new activity once a Menu Item is clicked, but I'm not sure how to do this. I've been reading through the android documentation, but my implementation isn't correct..and some guidance in the right direction…
45
votes
6 answers

How can I alter a MenuItem on the Options Menu on Android?

I have an Options Menu on my Activity with an MenuItem "Start". When this MenuItem is selected I would like to alter the Menu so it contains a MenuItem "Stop". And finally when "Stop" is selected, I would like to alter back to "Start". Here is parts…
Jonas
  • 121,568
  • 97
  • 310
  • 388
38
votes
6 answers

SearchView in OptionsMenu not full width

I have a working SearchView which expands in my OptionsMenu when the user taps on the search icon. However it only expands within the available space among the other OptionsMenu icons. On a wide screen this is fine, but with a narrow space there…
Peri Hartman
  • 19,314
  • 18
  • 55
  • 101
28
votes
3 answers

Callback when the options menu creation is complete

I need to make sure that the options menu has been created before i run a certain code that accesses one of the menu items. Is there a callback for that or how can i implement one? Is there any guaranties that the menu has been created on the…
Mak
  • 533
  • 7
  • 14
25
votes
4 answers

Android: onCreateOptionsMenu() item action

I have a menu created through: @Override public boolean onCreateOptionsMenu(Menu menu) { menu.add("Email"); return super.onCreateOptionsMenu(menu); } But I can't remember how to set a onclicklistener so when its selected I can run my…
Nick
  • 9,285
  • 33
  • 104
  • 147
18
votes
1 answer

Android - Refresh Options Menu without calling invalidateOptionsMenu()

Hello Android Developers, I have seen a lot of question regarding the update of Options Menu. However, every answer says I have to call invalidateOptionsMenu(). My question is, is there any other way of updating the Options Menu without invoking the…
Michael 'Maik' Ardan
  • 4,213
  • 9
  • 37
  • 60
17
votes
3 answers

Android options menu icon won't display

I'm following a book on Android Development to get myself started writing my first real app. I got up to the point where I'm making an options menu for one of my activities. The menu shows up, but the corresponding icon of the menu item refuses to…
Jort
  • 1,401
  • 8
  • 23
  • 39
11
votes
2 answers

openOptionsMenu() will not work in appcompat-v7 22.1.0 or newer

I've seen several reports of issues where openOptionsMenu() will not work on various Android versions, eg: openOptionsMenu() across android versions openOptionsMenu() not working but the issue I have seems to be related to the version of the…
11
votes
3 answers

Android ActionBar Recreate Options Menu

When using the ActionBar in Android, how do you refresh the options menu? I have tried hiding and showing the bar, along with getting a new instance of it with "getSupportActionBar()" I am trying to implement a Login/Logout button that will change…
Solder Smoker
  • 283
  • 1
  • 6
  • 14
9
votes
2 answers

"Scope Highlight" feature in Visual Studio? (same as seen in BlueJ for java)

I would like to know (as I've failed so far in finding such a feature in the VS's options), if there is a feature which allow for scope highlighting same as seen in the BlueJ IDE for java, here is an example: Note how the code blocks are all…
SwiftHands
  • 255
  • 3
  • 12
9
votes
5 answers

java.lang.illegalstateexception: a factory has already been set on this layoutinflater

I have tried to change the background color of options menu in my android app. I am using ActionBarSherlock library. I have tried this code for changing the background color of options menu https://stackoverflow.com/a/8475357/584095 But I ended up…
8
votes
2 answers

"No keyboard for id 0" - what does it mean?

Each time my Optionsmenu opens (onCreateOptionsMenu(..) is called), I get these warnings: "No keyboard for id 0" and "Using default keyMap: /system/usr/keychars/qwerty.kcm.bin" I couldn't find out what they mean, does anyone know ? I didn't…
cody
  • 6,389
  • 15
  • 52
  • 77
8
votes
1 answer

options menu - removing focus from item

how do I remove focus from options menu item? I.e. when I open the menu for the first time, none of the items has focus. however, if I focus on one of them using track ball, and then close and re-open the menu the focus is still there. How do I get…
Asahi
  • 13,378
  • 12
  • 67
  • 87
7
votes
1 answer

Open OptionsMenu of Activity leaks window on device rotation

Trying to understand what cause the window leak in my Activity. The activity extends AppCompatActivity. It has a single view with a RecyclerView and a ProgressBar invisible while rotating. @Override protected void onCreate(@Nullable Bundle…
6
votes
1 answer

WebView Back, Refresh, Forward? Simply doesn't work!

I have tried everything to get my 'forward' and 'back' to work. Refresh is working [I figured it out by changing the method to read 'webView.reload();' instead of 'webView.refresh();' Can anyone assist with the forward and back? I have tried…
1
2 3 4 5 6 7 8