Code example for CheckBoxPreference

Methods: setEnabled

0
            mChannel = mWifiP2pManager.initialize(mContext, mContext.getMainLooper(), null);
            if (mChannel == null) {
                //Failure to set up connection 
                Log.e(TAG, "Failed to set up connection with wifi p2p service");
                mWifiP2pManager = null;
                mCheckBox.setEnabled(false);
            } 
        } else { 
            Log.e(TAG, "mWifiP2pManager is null!");
        } 
        mIntentFilter = new IntentFilter(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION);
 
    } 
 
    public void resume() { 
        if (mWifiP2pManager == null) return;
        mContext.registerReceiver(mReceiver, mIntentFilter);
        mCheckBox.setOnPreferenceChangeListener(this);
    } 
 
    public void pause() {