how to stop ASyncTask thread in android

后端 未结 2 623
难免孤独
难免孤独 2020-12-03 11:01
can anybody have any idea how to stop ASyncTask thread in android?.

Actually i have a loop which creates threads and executes them. and when this l

2条回答
  •  旧巷少年郎
    2020-12-03 11:21

    In my experience with AsyncTask, calling cancel(boolean mayInterruptIfRunning) doesn't necessarily stop the execution of the background process. All that seems to happen is that the AsyncTask will execute onCancelled(), and won't run onPostExecute() when it completes. The behaviour probably depends on exactly what code you have in doInBackgound()

提交回复
热议问题