I have an application and because you can\'t do network operations on the main thread I\'m using AsyncTask
, so the question is once I execute()
the
onPostExecute()
is called from the UI thread - so if the UI thread is no longer running, it will not continue to run. However doInBackGround()
is ran from a separate worker thread so it will keep on until done (or if the JVM process is killed by the OS, which is also a possibility). Note that AsyncTasks are only recommended for shorter UI-bound background tasks and not long-running background work (a few seconds).
In short, you can not assume that it will keep on and definitely not assume that it will post its progress or call onPostExecute()
.