Restore Changed Menu State After Rotation Of A Device
I'm writing an application, which has a menu with buttons and an image. I press the button and label of the button changes from 'Record track' to 'Stop recording'. The issue is whe
Solution 1:
You should move your menu != null
block into onPrepareOptionsMenu:
public boolean onPrepareOptionsMenu(Menu menu)
{
MenuItem recordButton = menu.findItem(R.id.track);
if (isRecording) {
recordButton.setTitle(R.string.rec_track_label);
} else {
recordButton.setTitle(R.string.stop_rec_track_label);
}
}
As this method is called directly before the menu is being shown to the user.
Post a Comment for "Restore Changed Menu State After Rotation Of A Device"