Example usage for android.preference SwitchPreference setSwitchTextOff

List of usage examples for android.preference SwitchPreference setSwitchTextOff

Introduction

In this page you can find the example usage for android.preference SwitchPreference setSwitchTextOff.

Prototype

public void setSwitchTextOff(@StringRes int resId) 

Source Link

Document

Set the text displayed on the switch widget in the off state.

Usage

From source file:Main.java

static void addSwitchPreferenceBasedOnCheckBoxPreference(final CheckBoxPreference checkBox,
        final PreferenceGroup group) {
    final SwitchPreference switchPref = new SwitchPreference(checkBox.getContext());
    switchPref.setTitle(checkBox.getTitle());
    switchPref.setKey(checkBox.getKey());
    switchPref.setOrder(checkBox.getOrder());
    switchPref.setPersistent(checkBox.isPersistent());
    switchPref.setEnabled(checkBox.isEnabled());
    switchPref.setChecked(checkBox.isChecked());
    switchPref.setSummary(checkBox.getSummary());
    switchPref.setSummaryOn(checkBox.getSummaryOn());
    switchPref.setSummaryOff(checkBox.getSummaryOff());
    switchPref.setSwitchTextOn(EMPTY_TEXT);
    switchPref.setSwitchTextOff(EMPTY_TEXT);
    group.addPreference(switchPref);//from   w w  w.  j a v a 2 s. co m
    switchPref.setDependency(checkBox.getDependency());
}