Any listener that listen to events happening on your Views in your Activity 
should cease to receive message-notifications as soon as the Activity and 
its Window (and View hierarchy) are destroyed. 

But if your code or some other code did a postDelayed on the main UI 
Looper, they will be dispatched, activity being destroyed or not. If your 
Runnable, that is posted by calling postDelayed is executed and is still 
referring to a destroyed Activity, you may get into trouble. 

To avoid this, (1) make your Runnable a separate static class and refer to 
the Activity by a WeakReference or  (2) make your Runnable a field/member 
of your Activity and call removeCallbacks on that Runnable field/member in 
your implementation of onDestroy.

On Thursday, April 11, 2013 1:27:47 PM UTC-4, Shri wrote:
>
> When the currently-resumed Activity finishes itself, onPause and onStop 
> are clearly called. Is there any other code that executes on the Activity 
> or its views? Specifically:
>
>    1. Is it possible for any touch events (View#onTouchEvent) to be 
>    dispatched?
>    2. Can AnimationListener#onAnimationEnd be called for any animations 
>    that happenned to be in progress or just terminated? 
>    3. Can GestureDetector.OnDoubleTapListener.onSingleTapConfirmed be 
>    called (since it uses a timer to check if a second tap will be received or 
>    not)?
>
> I am seeing some rare crashes where it *seems* that these method may be 
> called after finish(). I am not sure about it, but wanted to understand 
> what the model is and what to expect. Unless finish() removes all 
> relevant pending Runnables from the Looper, it seems like any of the above 
> could happen.
>
> Thanks,
> Shri
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to