Quoting the AsyncTask documentation gotten from here, it says
- The AsyncTask class must be loaded on the UI thread. This is done automatically as of JELLY_BEAN.
- The task instance must be created on the UI thread.
execute(Params...)
must be invoked on the UI thread.- Do not call
onPreExecute()
,onPostExecute(Result)
,doInBackground(Params...)
,onProgressUpdate(Progress...)
manually.
Now what is the reason for creating the AsyncTask reference on the UI Thread ? Is it the problem with the Looper ?