you can use the application context

On Sat, Jul 24, 2010 at 5:28 AM, sasq <[email protected]> wrote:
>
> I have an AsyncTask that scans the file system and publishes progress
> through Notifications. To do this I need a reference to the current
> Activity in the AsyncTask.
>
> I also don't want to kill the task when the activity is destroyed. How
> do I avoid leaking the activity and everything it references on each
> configuration change?
>
> One possibility is to remove the reference in OnPause() to be sure it
> is gone when the Activity is destroyed, but that would mean
> notifications stops coming as soon as you leave the activity which is
> no good.
>
> Isn't there a recommended way of dealing with AsyncTasks in this way?
>
> --
> 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 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