Code example for Field

Methods: setAccessible, setBoolean

0
        // http://stackoverflow.com/questions/9286822/how-to-force-use-of-overflow-menu-on-devices-with-menu-button 
        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 - but at least we tried ;-) 
        } 
 
        // we do not want focus on custom views ( mainly for GTV ) 
        /* 
         * wd if ((this.getSupportActionBar()!=null) && 
		 * (this.getSupportActionBar().getCustomView()!=null)) 
		 * this.getSupportActionBar().getCustomView().setFocusable(false); 
		 * 
		 */ 
 
        playServicesIntegration = new PlayServicesIntegration(this);