How to check if Async Task is already running

后端 未结 4 545
一个人的身影
一个人的身影 2020-12-30 19:52

I have an app that needs to do an intensive database operation on start up. The app holds a local copy of the contacts on the phone and synchronizes with the android contact

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-30 20:26

    Use getStatus() to get the status of your AsyncTask. If status is AsyncTask.Status.RUNNING then your task is running.

    EDIT: you should reconsider your implementation and hold the AsyncTask probably in a Service or IntentService to fetch your data from the web.

提交回复
热议问题