The hack that developers have used in the past to allow a Hardware and Software menu button in the ActionBar
, is:
try {
ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
if (menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
}
} catch (Exception e) { e.printStackTrace(); }
Results in: java.lang.NoSuchFieldException: sHasPermanentMenuKey
So the hack doesn't work anymore, an alternative? Edit: So the hack never worked for < Android 4.2, an alternative (without creating the button yourself)?
(I don't want to start another discussion as in How To Control use of OverFlow Menu in ICS about pros and cons of this approach)