Code example for Switch

Methods: setEnabled

0
                break; 
            case WifiManager.WIFI_STATE_DISABLED:
                setSwitchChecked(false); 
                mSwitch.setEnabled(true);
                break; 
            default: 
                setSwitchChecked(false); 
                mSwitch.setEnabled(true);
                break; 
        } 
    } 
 
    private void setSwitchChecked(boolean checked) {
        if (checked != mSwitch.isChecked()) {
            mStateMachineEvent = true;
            mSwitch.setChecked(checked);
            mStateMachineEvent = false;
        } 
    } 
 
    private void handleStateChanged(@SuppressWarnings("unused") NetworkInfo.DetailedState state) {