Code example for CheckBoxPreference

Methods: setChecked

0
    } 
 
    @Override 
    public void onDismiss(DialogInterface dialog) {
        if (!mOkClicked) {
            mEnableReporting.setChecked(false);
        } 
    } 
 
    @Override 
    public void onClick(DialogInterface dialog, int which) {
        if (which == DialogInterface.BUTTON_POSITIVE) {
            mOkClicked = true;
            mPrefs.edit().putBoolean(ANONYMOUS_OPT_IN, true).apply();
            ReportingServiceManager.launchService(getActivity()); 
        } else if (which == DialogInterface.BUTTON_NEGATIVE) {
            mEnableReporting.setChecked(false);
        } else { 
            Uri uri = Uri.parse("http://www.cyanogenmod.org/blog/cmstats-what-it-is-and-why-you-should-opt-in");
            startActivity(new Intent(Intent.ACTION_VIEW, uri));
        }