summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/java/android/animation/LayoutTransition.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/animation/LayoutTransition.java b/core/java/android/animation/LayoutTransition.java
index d1bc9bd..69ad67e 100644
--- a/core/java/android/animation/LayoutTransition.java
+++ b/core/java/android/animation/LayoutTransition.java
@@ -520,6 +520,10 @@ public class LayoutTransition {
staggerDelay = 0;
final ViewTreeObserver observer = parent.getViewTreeObserver(); // used for later cleanup
+ if (!observer.isAlive()) {
+ // If the observer's not in a good state, skip the transition
+ return;
+ }
int numChildren = parent.getChildCount();
for (int i = 0; i < numChildren; ++i) {
@@ -607,7 +611,7 @@ public class LayoutTransition {
// layout listeners.
observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
public boolean onPreDraw() {
- observer.removeOnPreDrawListener(this);
+ parent.getViewTreeObserver().removeOnPreDrawListener(this);
int numChildren = parent.getChildCount();
for (int i = 0; i < numChildren; ++i) {
final View child = parent.getChildAt(i);