Ashwani Kumar
Ashwani Kumar

Reputation: 854

What happens when invalidateOptionsMenu() is called in Android?

I am very keen to know what happens when an call to invalidateOptionsMenu() is made. Does it redraws the whole actionbar or just place a call to onCreateOptionsMenu() which follows with onPrepareOptionsMenu(). As per android source code it declare that the options menu has changed, so should be recreated. The onCreateOptionsMenu(android.view.Menu) method will be called the next time it needs to be displayed. I have certain points that needs clarification:

Upvotes: 1

Views: 3442

Answers (1)

Smittey
Smittey

Reputation: 2492

It declares that the options menu has changed, so should be recreated. The onCreateOptionsMenu(Menu) method will be called the next time it needs to be displayed.

Does it affects the ActionBar tabs in any way?

It will redraw them.

Does it affects the viewpager inside the layout of activity?

It does not.

Does it impacts the fragments associated with actionbar tabs?

It does not

Upvotes: 4

Related Questions