AsyncTask: doInBackground not called

后端 未结 3 950
旧巷少年郎
旧巷少年郎 2021-02-03 10:59

I have a problem with the AsyncTask. Sometimes the doInBackground() method is not called after onPreExecute().

I know this questio

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-03 11:13

    It happened to me one time because some of my tasks were blocked in the doInBackground() (which is obviously impossible with the code sample you pasted).

    The default pool size on Android for the THREAD_POOL_EXECUTOR was 5 the last time I have checked. So if you execute more than 5 tasks at the same time the next ones will wait until a task is finished.

    It's the only case I known to prevent a doInBackground() call.

提交回复
热议问题