Tuesday, 22 September 2015

Forcing overflow menu


    Add the following code on your activity in
    "oncreate" method after "setcontentview"


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

No comments:

Post a Comment