belle tian
belle tian

Reputation: 897

When will the method "onPrepareOptionsMenu" be called?

I create a menu.xml , only one action item with the "always" inside it. now I want to use the this method to change the menu's visible ,remove old action item , add new action item , change the old action item's icon ... so how to implement this ? I don't want the onCreateOptionMenu to be called more than once as the activity has presented by Android system.

Upvotes: 0

Views: 1064

Answers (1)

Haniyeh Khaksar
Haniyeh Khaksar

Reputation: 804

onPrepareOptionsMenu() will be called automatically after onCreateOptionsMenu().

And if you called invalidateOptionsMenu() on any action-item click event, then, it will be called again.

Upvotes: 1

Related Questions