I can't find a way to use AsyncTask to update the UI
Here's my pseudo-code
public class MissionsActivity extends Activity {
private class UpdateMissions extends AsyncTask<Void, Long, Void> {
protected Void doInBackground(Void... voids) {
while(true) {
try {
Thread.sleep(250);/
/*HERE I GET time1, time2, time3 and currentTime READING A FILE*/
publishProgress(time1,time2,time3,currentTime);
} catch (Exception e) {
}
}
}
protected void onProgressUpdate(Long time1, Long time2, Long time3, Long currentTime) {
/*HERE I MANIPOLATE time1, time2, time3 and currentTime TO UPDATE THE UI*/
}
Then in the main class (the one that extends Activity), in the onCreate I do
update = new UpdateMissions();
update.execute(null,null,null);
But it does nothing. I'm really hitting a wall here, I need serious help since I never used AsyncTask before.
The while(true)
part doesn't let me get to the pre or post execute methods, so I have to use the progress one, but I can't get where the error is.
Thanks in advance