Questions tagged [oncreateoptionsmenu]

112 questions
1
vote
2 answers

Options Menu null at runtime

I am changing the drawable of a specific menu item when certain actions are made within my app. Everything works as it should except for when I try and do this in the onCreate method of my Activity. I am using the following…
1
vote
0 answers

animateCamera() doesn't work after calling invalidateOptionsMenu

I've added onNewIntent(intent) to my activity, so when it's called it should zoom on a specific location on my map and then call invalidateOptionsMenu(), so that onCreateOptionsMenu() can be called and update the spinner in my action bar with the…
1
vote
2 answers

How to Trigger onCreateOptionsMenu automatically

I want to show onCreateOptionsMenu which is on the right top side of the application. without touching on the three dots. what i am actually planing to do is, when the app runs for the first time i want show the menu items to user automatically, how…
1
vote
2 answers

Android onCreateOptionsMenu findItem get null

I'm new to android development. I created a new project with android studio default project template, Navigation Drawer Activity. I added debug message as follow: public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds…
bns
  • 397
  • 1
  • 5
  • 13
1
vote
1 answer

Cannot call method onCreateOptionsMenu () on startup for napp drawer

I have a problem only with nap drawer module.I have this code: **drawer = NapDrawerModule.createDrawer({ //parameter for the drawer });** Then I have: * *drawer.getActivity().onCreateOptionsMenu = function(e) { //code for creation menu** } Problem…
1
vote
1 answer

oncreate option menu of fragment stoppng activity oncreateoptionmenu

I have one activity and five fragments.I have a navigation drawer button in option menu which helps me to navigate through fragment.But on one fragment i want to change that to back button.Currently back button is working correctly.But together with…
sachithkn
  • 457
  • 1
  • 4
  • 13
1
vote
1 answer

MenuItem setVisible on onRestoreInstanceState

I am using the method onRestoreInstanceState of android to get the information when the screen rotates and it works fine except for one thing. When i try to set visible a menuItem that have initialized in onCreateOptionsMenu, it gets…
1
vote
2 answers

is there a way to test onCreateOptionsMenu(Menu menu) in android?

i want to write a test to validate what i do in onCreateOptionsMenu Can anyone assist me how to go about it? @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.global, menu); …
alitha
  • 325
  • 1
  • 3
  • 6
1
vote
0 answers

Increasing ActionBar's height but Action-Icons don't occupy that height

I can increase the ActionBar's height to its double size (by Default is action_bar_default_height = 48dp standard ActionBarSize), so, 96dp but the Icons of my ActionBarare just as little as with standard height. In order to acquire a better…
Gödel77
  • 839
  • 3
  • 15
  • 27
1
vote
1 answer

Android: How to prevent certain methods from being created when Application created?

When I create an Android application within Eclipse Juno with Target: Android-19 (4.4.2) , I only want the onCreate() method to be created within my Activity. However, at the minute I am getting the following when I create my Activity, Note that I…
user4125772
  • 159
  • 1
  • 10
1
vote
1 answer

ABS to AppCompat

I am trying now to change ABS actionbar to AppCompat. I need to force the following code, whitch works fine with SherlockFragment, to work in android.support.v4.app.Fragment. I need to add custom view into Menu. How can I do this right in…
1
vote
0 answers

Android OnPrepareOptionsMenu does not work as expected on API 16

In my app I have one fragment that I add by calling replace() on fragmentTransaction. This fragment, let´s call it Fragment1, has some menu items that are added to action bar by calling onCreateOptionsMenu and setHasOptionsMenu(true) in onCreate().…
1
vote
1 answer

OnOptionsMenu causes the app to crash

The auto-generated OnCreateOptionsMenu in a certain activity, causes the app to crash when I press the options button in the device, despite, the same action does not crash the app while accessing others activities of the same app. One of the…
user3558352
1
vote
2 answers

Application crashes on clicking the item in Options Menu

I am working on an android application called 'MyBMI'. I have created an item called 'About MyBMI' in the options menu which when clicked takes the user to another activity called 'AboutActivity'. But, when I click 'About MyBMI' in the options menu,…
CodeWalker
  • 2,281
  • 4
  • 23
  • 50
1
vote
2 answers

OnCreateOptionsMenu with ActionBarSherlock library

I'm using ActionBarSherlock library in my app. I followed this Tutorial but it is not working, app crashes as soon as it starts due to OnCreateOptionsMenu(). I can get what is the error. Please help 03-11 14:29:16.037: W/MenuInflater(10097): Cannot…