NiceSwitch niceSwitch = findViewById(R.id.inappbrowser_switch); niceSwitch.setChecked(true); // This sets the switch state to "ON" This is not working