diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java index 682f2ae1f311a..8b97329646b47 100644 --- a/core/java/android/widget/Switch.java +++ b/core/java/android/widget/Switch.java @@ -833,6 +833,10 @@ public class Switch extends CompoundButton { public void setChecked(boolean checked) { super.setChecked(checked); + // Calling the super method may result in setChecked() getting called + // recursively with a different value, so load the REAL value... + checked = isChecked(); + if (isAttachedToWindow() && isLaidOut()) { animateThumbToCheckedState(checked); } else {