Code example for CheckBoxPreference

Methods: isChecked, setChecked

0
    } 
 
    @Override 
    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
        if (preference == mToggleAppInstallation) {
            if (mToggleAppInstallation.isChecked()) {
                mToggleAppInstallation.setChecked(false);
                warnAppInstallation(); 
            } else { 
                setNonMarketAppsAllowed(false); 
            } 
        } 
 
        return super.onPreferenceTreeClick(preferenceScreen, preference);
    } 
 
    public void onClick(DialogInterface dialog, int which) {
        if (dialog == mWarnInstallApps && which == DialogInterface.BUTTON1) {
            setNonMarketAppsAllowed(true); 
            mToggleAppInstallation.setChecked(true);
        }