Android/Java: onProgressUpdate() not being called?
android, breakpoints, java
Solution
I think that you missed somethings on your code. Try with this one:
private class DoHardWork extends AsyncTask<Void, String, Long> {
protected Long doInBackground(Void... urls) {
publishProgress("Requesting XML data");
this.requestData();
publishProgress("Returning results");
this.returnResults();
return null;
}
protected void onProgressUpdate(String... progress) {
super.onProgressUpdate(progress);
MainActivity.setLog(progress[0]);
}
}
Problem
I've read similar threads on here, even googled but no solution. onProgressUpdate() is just not being called. Here's the code: ``` public class DoHardWork extends AsyncTask { @Override protected Object doInBackground(Object... params) { publishProgress("Requesting XML data"); this.requestData(); publishProgress("Returning results"); this.returnResults(); return null; } protected void onProgressUpdate(String text) { super.onProgressUpdate(text); MainActivity.setLog(text); } } ``` I tried setting a breakpoint in onProgressUpdate() and it's never called. It's like the code is just ignored. Someone had a similar problem and it turned out to be just eclipse just messing with him but i tried restarting it with no success. Any ideas?