I am creating a menu in android overriding the onCreateOptionsMenu method like so:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, 0, 0, "Blit").setCheckable(true);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == 0)
{
somevar = !somevar;
item.setchecked(somevar);
}
}
The problem is that the menu is never checked … how can i make my menu checked?
You have to update all menu items when
onPrepareOptionsMenuis called.