switch button in android code example

Example 1: stop displaying button in android

myButton.setEnabled(false);

Example 2: android switch on change

mySwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        // do something, the isChecked will be
        // true if the switch is in the On position
    }
});

Example 3: android how to change focus on confirm button on keyboard

android:nextFocusDown="@+id/.."  
android:nextFocusLeft="@+id/.."    
android:nextFocusRight="@+id/.."    
android:nextFocusUp="@+id/.."

Tags:

Java Example