Hi Mark, thanks for your swift reply. I thought my AsyncTask got destroyed somehow, but from your response it seems like just my ProgressDialog got dismissed. Is there a way I can prevent that? I want the computation in AsyncTask to be done before user can interact with the UI again.
And second question, can I override the back button somehow so I could catch the call in my AsyncTask and cancel it? Filip Havlicek 2010/8/15 Mark Murphy <[email protected]> > On Sun, Aug 15, 2010 at 5:37 PM, Filip Havlicek > <[email protected]> wrote: > > I'm just wondering what happens to running AsyncTask when the back button > is > > pressed. > > Nothing happens to your AsyncTask when the BACK button is pressed. > > > Doesn't seem to invoke onCancelled or onPostExecute in my > > AsyncTask. > > Correct. Bear in mind that AsyncTask does not have to be used by an > Activity. It could be used by a Service, for example. > > > When I call cancel(false), onCancelled method is called, but > doInBackground > > continues in execution > > Correct. Passing false means you do not want to stop the task if it is > already started, versus just pending in the work queue. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://github.com/commonsguy > http://commonsware.com/blog | http://twitter.com/commonsguy > > _The Busy Coder's Guide to Android Development_ Version 3.1 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]<android-developers%[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

