Android : action bar not showing in android 4.2

on Saturday, August 2, 2014


as the action bar is introduced in android 3.0 my app was showing action bar in android 4.2 and not showing in 2.3


I was trying to show menu items as overflow icon in action bar for android 3.0 and up.. But unfortunately my app is not showing action bar in any android version.


please help me.. I want to show action bar for all android versions and i want to show menu items as overflow icon.


I was trying this code for action bar overflow icon.



try {
ViewConfiguration config = ViewConfiguration.get(this);
java.lang.reflect.Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
if(menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
}
} catch (Exception ex) {
// Ignore
}


I have added this code in my main activity after setContentView


0 comments:

Post a Comment