Mark Wyszomierski wrote:
> I tried the following from an activity:
> 
>   @Override
>   public void onPause() {
>       super.onPause();
> 
>       postDelayed(new Runnable() { public void run() {
>           mTextView.setText("I am paused!");
>       }, 10000);
>   }
> 
> The activity, while in the background, still executes the runnable. Is
> this incorrect?

AFAIK, this is correct behavior.

> Should we absolutely call removeCallback() from our
> onPause() handler to ensure that no postDelayed() runnables execute if
> we get paused? Or is it necessary to do this only in onDestroy()?

None of the above, at least in terms of the "absolutely" part. You are
welcome to do that, or keep it running, or keep it running and watch an
AtomicBoolean to determine what do to when the Runnable gets invoked, or
whatever.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 1.0 Available!

-- 
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

Reply via email to