Android AsyncTask - avoid multiple instances running

前端 未结 7 1735
夕颜
夕颜 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条回答
  •  不知归路
    2020-12-25 15:52

    try having some instance boolean value that gets set to "true" on the asynctask's preexecute then "false" on postexecute. Then maybe in doinbackground check if that boolean is true. if so, then call cancel on that particular duplicate task.

提交回复
热议问题