The Developer Guide says:
Do not call onPreExecute(), onPostExecute(Result), doInBackground(Params…), onProgressUpdate(Progress…) manually.
So it is indeed bad practice to call doInBackground(Params) manually.
Here are some rules:
The AsyncTask class must be loaded on the UI thread. This is done automatically as of Build.VERSION_CODES.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.
The task can be executed only once (an exception will be thrown if a second execution is attempted.)
Unfortunately there is no clear documentation why you should not call any method manually but the main reason might be that if you call doInBackground() manually your code could get executed in you main thread instead of a background thread.
…is it bad practice to do that?
Answer: Yes it is!
0
solved Thread pool in Android, calling doinbackground directly