Code example for Preference

Methods: setEnabled

0
    private void onTogglesUpdate(Bundle toggleInfo) {
        mToggles = toggleInfo.getStringArrayList("toggles");
        sToggles = toggleInfo;
        if (mToggles.contains("FAVCONTACT")) {
            if (mFavContact != null) {
                mFavContact.setEnabled(true);
            } 
        } else { 
            if (mFavContact != null) {
                getPreferenceScreen().removePreference(mFavContact);
            } 
        } 
    } 
 
    @Override 
    public void onResume() { 
        super.onResume(); 
        requestAvailableToggles(); 
    } 
 
    @Override