tags:

views:

91

answers:

2

In an Activity, I need to call a web service every 30 seconds or so, and use the data to update the UI.

Is there a recommended approach on how to schedule a repetitive task?

Thanks

+2  A: 

If this is in a running activity, you could use Timer/TimerTask and a Handler, or you could use postDelayed() and an AsyncTask.

CommonsWare
+1  A: 

You will want to create a Handler. Here is a brief code example.

ElectricDialect