Skip to content
Advertisement

Tag: optionmenu

Why click on optionsMenu item doesn’t work?

I have a problem when clicking on an item from an options menu. I’ve read how to create a menu on the website https://developer.android.com/guide/topics/ui/menus and I seem to do it right, but it still doesn’t work. The menu exists, it is visible, but nothing happens when I perform the click. Also, there are no errors in the Logcat. The XML

onCreateOptionsMenu not being called

onCreateOptionsMenu does not get called in a fragment. I have to manually call setHasOptionsMenu(true) in onCreatedView() but this causes the item.itemId be an empty String “” in the onOptionsItemSelected() and therefore i can’t detect which menu item was tapped. I’m currently using this in a fragment: Answer Call super.onCreateOptionsMenu(menu,inflater) after menu inflate This may more help Ref :: https://stackoverflow.com/a/15654039/11393354 try

Advertisement