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
When you call finish() on Activity, the Activity is destroyed, but the main thread is not. [NOTE: Activity runs on Main Thread. Activity is not Main Thread. ]
So, doInBackground() on background thread and onPostExecute() on main thread will be executed. However, if onPostExecute() does any UI-related tasks, you will get ANR because there is no UI at this point. For eg, if you just print a Log.d() statement inside onPostExecute(), the statement will be visible in Logcat.
** These will be possible only if the process is alive, & is not killed by Android Low Memory Killer.