Jelly bean not calling onPrepareOptionsMenu() when opening the menu for the first time

Posted by syloc on Stack Overflow See other posts from Stack Overflow or by syloc
Published on 2012-10-14T21:35:59Z Indexed on 2012/10/14 21:36 UTC
Read the original article Hit count: 234

I'm overriding onPrepareOptionsMenu to hide and show menu items. When testing it with the API level 16 emulator; onPrepareOptionsMenu is not called when opening the menu for the first time. But when i reopen the menu it works. The problem is only with the first usage. You can simple test it with this;

@Override
public void onPrepareOptionsMenu(Menu menu) {
    Toast.makeText(this.getActivity(), "pre", Toast.LENGTH_SHORT).show();
    super.onPrepareOptionsMenu(menu);
}

Any ideas?

© Stack Overflow or respective owner

Related posts about android

Related posts about android-emulator