Best code examples for Android Switch class (android.widget.Switch)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Switch class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android Switch examples from Open Source projects
This code example shows how to use the following methods: isChecked, setOnCheckedChangeListener, setChecked, setEnabled
137:	mSwitch.setEnabled(true); 
-
146:	if (isChecked != mSwitch.isChecked()) { 
-
150:	mSwitch.setOnCheckedChangeListener(null); 
-
152:	mSwitch.setChecked(isChecked); 
-
154:	mSwitch.setOnCheckedChangeListener(this); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isChecked, setOnCheckedChangeListener, setChecked
146:	if (isChecked != mSwitch.isChecked()) { 
-
150:	mSwitch.setOnCheckedChangeListener(null); 
-
152:	mSwitch.setChecked(isChecked); 
-
154:	mSwitch.setOnCheckedChangeListener(this); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setChecked, setEnabled
94:	mActionBarSwitch.setEnabled(false); 
-
101:	mActionBarSwitch.setChecked(desiredState); 
-
103:	mActionBarSwitch.setEnabled(true); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isChecked, setOnCheckedChangeListener, setChecked
52:	mSwitch.setOnCheckedChangeListener(this); 
-
63:	if (checked != mSwitch.isChecked()) { 
-
65:	mSwitch.setChecked(checked); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setOnCheckedChangeListener
42:	mSwitch.setOnCheckedChangeListener(null); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isChecked, setChecked
69:	if (checked != mSwitch.isChecked()) { 
-
71:	mSwitch.setChecked(checked); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setChecked, setEnabled
94:	mActionBarSwitch.setEnabled(false); 
-
101:	mActionBarSwitch.setChecked(desiredState); 
-
103:	mActionBarSwitch.setEnabled(true); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setOnCheckedChangeListener
59:	mSwitch.setOnCheckedChangeListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isChecked
152:	if (mTimeLapseSwitch.isChecked()) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isChecked, setChecked
69:	if (checked != mSwitch.isChecked()) { 
-
71:	mSwitch.setChecked(checked); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isChecked, setChecked
69:	if (checked != mSwitch.isChecked()) { 
-
71:	mSwitch.setChecked(checked); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isChecked, setOnCheckedChangeListener, setChecked
52:	mSwitch.setOnCheckedChangeListener(this); 
-
63:	if (checked != mSwitch.isChecked()) { 
-
65:	mSwitch.setChecked(checked); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isChecked, setChecked
75:	if (checked != mSwitch.isChecked()) { 
-
77:	mSwitch.setChecked(checked); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isChecked, setChecked
69:	if (checked != mSwitch.isChecked()) { 
-
71:	mSwitch.setChecked(checked); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isChecked, setOnCheckedChangeListener, setChecked
47:	if (mSwitch.isChecked() != isEnabled) 
48:	mSwitch.setChecked(isEnabled); 
-
72:	mSwitch.setOnCheckedChangeListener(this); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isChecked, setOnCheckedChangeListener, setChecked
47:	if (mSwitch.isChecked() != isEnabled) 
48:	mSwitch.setChecked(isEnabled); 
-
72:	mSwitch.setOnCheckedChangeListener(this); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isChecked, setChecked
179:	final boolean checked = mHardKeyboardSwitch.isChecked(); 
-
329:	if (mHardKeyboardSwitch.isChecked() != mHardKeyboardEnabled) { 
330:	mHardKeyboardSwitch.setChecked(mHardKeyboardEnabled); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isChecked, setChecked
69:	if (checked != mSwitch.isChecked()) { 
-
71:	mSwitch.setChecked(checked); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isChecked, setChecked
69:	if (checked != mSwitch.isChecked()) { 
-
71:	mSwitch.setChecked(checked); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isChecked, setChecked
60:	if (checked != mSwitch.isChecked()) { 
-
62:	mSwitch.setChecked(checked); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setOnCheckedChangeListener
46:	mSwitch.setOnCheckedChangeListener(null); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setOnClickListener, setText
42:	mSwitchView=new Switch(getActivity()); 
-
60:	mSwitchView.setText("开启均衡器:"); 
61:	mSwitchView.setOnClickListener(new OnClickListener() { 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isChecked, setChecked
69:	if (checked != mSwitch.isChecked()) { 
-
71:	mSwitch.setChecked(checked); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setActivated, setOnCheckedChangeListener, setChecked
117:	stDO.setOnCheckedChangeListener(this);	// set listener must be after updateUI. Or Initial update UI will trigger the 'OnChechedChange' event 
-
189:	this.stDO.setActivated(true); 
190:	this.stDO.setChecked(false); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setOnCheckedChangeListener
34:	mSwitch.setOnCheckedChangeListener(listener); 
Full Snippet Info
5
CodeRank
Related Android Switch Questions & Answers:
See Code Examples for Android Switch Methods: