1

I have started a AsyncTask to decode the contents in a file on a Button click. AsyncTask is running fine, now I pressed home button. Activity entered into onStop() state. Now what happens to my AsyncTask, Will it run or stop in this onStop() state?

Kanwaljit Singh
  • 4,339
  • 2
  • 18
  • 21
saa
  • 1,538
  • 2
  • 17
  • 35

2 Answers2

1

activity stop will not make your async task to stop. Your async task will continue and if you have some reference of view in post execute it will cause exception.

You can also use AsyncTaskLoader instead.

Read about it:

http://mobile.dzone.com/articles/loaders-versus-asynctask

vipul mittal
  • 17,343
  • 3
  • 41
  • 44
1

No it can't be. Your activity has been stopped your AsyncTask will continues. IF you want to stop it you have to cancel your AsyncTask.

Piyush
  • 18,895
  • 5
  • 32
  • 63