Android AsyncTask - avoid multiple instances running

前端 未结 7 1733
夕颜
夕颜 2020-12-25 15:36

I have AsyncTask that processes some background HTTP stuff. AsyncTask runs on schedule (Alarms/service) and sometime user executes it manually.

I process records fro

7条回答
  •  旧时难觅i
    2020-12-25 16:00

    Or, you can try this to see if the Task is currently running or not:

    if (katitsAsyncTask.getStatus().equals(AsyncTask.Status.FINISHED))
         katitsAsyncTask.execute();
    else
         // wait until it's done.
    

提交回复
热议问题