You have three protected methods in an AsyncTask that can interact with the UI.
onPreExecute()
- runs before
doInBackground()
- runs before
onPostExecute()
- runs after
doInBackground()
completes
- runs after
onProgressUpdate()
- this only runs when
doInBackground()
calls it withpublishProgress()
- this only runs when
If in your case the Task runs for a lot longer than the 30 seconds you want to refresh you would want to make use of onProgressUpdate()
and publishProgress()
. Otherwise onPostExecute()
should do the trick.
See the official documentation for how to implement it.