Bart Friederichs Bart Friederichs - 1 year ago 160
Android Question

onCreateOptionsMenu is never called

I am having some trouble getting an options menu working in Android. I build apps before, and they all worked fine, but now the menu just doesn't pop up.

The code:

public boolean onCreateOptionsMenu(Menu menu) {

getMenuInflater().inflate(, menu);
return true;

the whole method is never even called (checked by setting a breakpoint). The activity is super-simple, it just has a
in it, with an

I am using Android 4.0.4 on a Samsung Galaxy 10.1, API level 15, minSDK 15. Am I missing something?

Answer Source

If the phone you test on has a menu button onCreateOptionsMenu wont't be called on start with the theme:


But when you click the menu button the onCreateOptionsMenu will be called. I don't know what happens on phones without hardware buttons...