Thursday, 3 October 2013

Android: Changing menu items in an options menu at runtime

Android: Changing menu items in an options menu at runtime

I have an xml file that defines the items in a menu for an app that
manages people you know.
One of these items is Mark selected person and another is Delete marked
people.
My problem is as follows: I don't want the Delete marked people menu item
in the options menu if no one is marked.
What is the simplest way I can implement this?
Thank you.
EDIT: I do not think this is a duplicate, I read the accepted answer of
the post you linked about enabling/disabling the option menu, all it does
is makes it gray and unresponsive when you click it - I find this
aesthetically unpleasing and would like the item to not be there at all.

No comments:

Post a Comment