diff --git a/tourguide/src/main/java/tourguide/tourguide/FrameLayoutWithHole.java b/tourguide/src/main/java/tourguide/tourguide/FrameLayoutWithHole.java index 0fffe71..28b0532 100644 --- a/tourguide/src/main/java/tourguide/tourguide/FrameLayoutWithHole.java +++ b/tourguide/src/main/java/tourguide/tourguide/FrameLayoutWithHole.java @@ -141,7 +141,7 @@ private void init(AttributeSet attrs, int defStyle) { private boolean mCleanUpLock = false; protected void cleanUp(){ if (getParent() != null) { - if (mOverlay!=null && mOverlay.mExitAnimation!=null) { + if (mOverlay!=null && mOverlay.mExitAnimation!=null && !mCleanUpLock) { performOverlayExitAnimation(); } else { ((ViewGroup) this.getParent()).removeView(this); @@ -158,7 +158,7 @@ private void performOverlayExitAnimation(){ @Override public void onAnimationRepeat(Animation animation) {} @Override public void onAnimationEnd(Animation animation) { - ((ViewGroup) _pointerToFrameLayout.getParent()).removeView(_pointerToFrameLayout); + if((_pointerToFrameLayout.getParent())!=null) ((ViewGroup) _pointerToFrameLayout.getParent()).removeView(_pointerToFrameLayout); } }); this.startAnimation(mOverlay.mExitAnimation);