0

I have a service which starts from a broadcast and will run and import the vcards . I would like to show a progressbar if the service is still running when the user opens the app which has this service . and dismiss the progress bar once the service is stopped.

How can I achieve this.

Rohit Walavalkar
  • 790
  • 9
  • 28

1 Answers1

1

You can create an AsyncTask that checks whether the service is running. In the AsyncTask, you can open the progress bar in the onPreExecute if the service isn't running. In the doInBackground periodically check whether the service is running and only return when you find the service is no longer running. Then in the onPostExecute, you can dismiss the progress bar.

Jim
  • 6,753
  • 12
  • 44
  • 72