Thursday, June 5, 2014

Android Tips: How to (always) show Overflow in Action bar

Here is how!

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();
    }