Reputation: 1307
I have a set of MenuItems in ActionBar and WebView is used to display a webpage which is part of .Net project, now when user login into the webApplication, is there any possibility to change MenuItem dynamically? I'm not sending any request to server. Is there any way to capture latest url that has been loaded into webview and compare it with some other parameter?
Upvotes: 1
Views: 430
Reputation: 4599
You have to override onPrepareOptionMenu inorder to update menu item.
See below piece of code:
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem menuItem = (MenuItem) menu.findItem(R.id.---);
//your code...........
}
Upvotes: 2
Reputation: 1508
Just override onPrepareOptionsMenu(Menu menu) in Activity or Fragment, you can get the reference of Menu in this method. invoke invalidateOptionsMenu() when you want to get onPrepareOptionsMenu(Menu menu) invoked.
Upvotes: 1