summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2011-09-02 13:23:02 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-09-02 13:23:02 -0700
commitcc967196252d380d76dd097287772bad3c606a87 (patch)
tree03db3e58c8972e0def724d3ee2e932f2404e0114 /core
parent185c8f05a0dd3a08abcb7edb04146a79673ca90f (diff)
parent1737fcd689072cabcb9937316ba159ee954f3536 (diff)
downloadframeworks_base-cc967196252d380d76dd097287772bad3c606a87.zip
frameworks_base-cc967196252d380d76dd097287772bad3c606a87.tar.gz
frameworks_base-cc967196252d380d76dd097287772bad3c606a87.tar.bz2
am 1737fcd6: Merge "Fix for NPE in Switch"
* commit '1737fcd689072cabcb9937316ba159ee954f3536': Fix for NPE in Switch
Diffstat (limited to 'core')
-rw-r--r--core/java/android/widget/Switch.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java
index 4fcb358..02c9d03 100644
--- a/core/java/android/widget/Switch.java
+++ b/core/java/android/widget/Switch.java
@@ -161,6 +161,7 @@ public class Switch extends CompoundButton {
mMinFlingVelocity = config.getScaledMinimumFlingVelocity();
// Refresh display with current params
+ refreshDrawableState();
setChecked(isChecked());
}
@@ -632,8 +633,9 @@ public class Switch extends CompoundButton {
int[] myDrawableState = getDrawableState();
// Set the state of the Drawable
- mThumbDrawable.setState(myDrawableState);
- mTrackDrawable.setState(myDrawableState);
+ // Drawable may be null when checked state is set from XML, from super constructor
+ if (mThumbDrawable != null) mThumbDrawable.setState(myDrawableState);
+ if (mTrackDrawable != null) mTrackDrawable.setState(myDrawableState);
invalidate();
}