Why is onProgressUpdate
not being called?
public class DoStuff extends AsyncTask<Integer, Integer, String> {
private MainActivity activity;
public DoStuff(MainActivity a){
activity = a;
}
protected String doInBackground(Integer... params) {
Integer loops = params[0];
for (int i = 0; i <= loops.intValue() ; i++) {
SystemClock.sleep(1000);
publishProgress(new Integer((i / loops) * 100));
}
return "Done: " + loops.intValue();
}
protected void onProgressUpdate(Integer progress)
{
activity.updateProgress("" + progress.intValue() + "%");
}
}