This most likely shows up when you are trying to hide the actionbar in your app's activities.
You may be using:
requestWindowFeature(Window.FEATURE_NO_TITLE);
However, you may see NullPointerException (@ActionBarImplICS:getThemedContext:287) {main} when users press the menu button in their devices. Some Android devices have the menu button as the hardware button, while Kindle Fire devices have the menu button as a software button.
To prevent the crash from happening, you can override the menu button key code to do nothing:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ( keyCode == KeyEvent.KEYCODE_MENU ) {
// do nothing
return true;
}
return super.onKeyDown(keyCode, event);
}
No comments:
Post a Comment