Fixed issue in the downloadObserver class that could cause a crash

This commit is contained in:
daniel oeh 2012-07-10 16:45:48 +02:00
parent fc98cc8c79
commit 7088df944c
2 changed files with 39 additions and 36 deletions

View File

@ -179,7 +179,8 @@ public class DownloadActivity extends SherlockListActivity implements
@Override @Override
public void onFinish() { public void onFinish() {
Log.d(TAG, "Observer has finished, clearing adapter");
dla.clear(); dla.clear();
dla.notifyDataSetChanged(); dla.notifyDataSetInvalidated();
} }
} }

View File

@ -51,8 +51,6 @@ public class DownloadObserver extends AsyncTask<Void, Void, Void> {
} }
} }
@Override @Override
protected void onPostExecute(Void result) { protected void onPostExecute(Void result) {
Log.d(TAG, "Background task has finished"); Log.d(TAG, "Background task has finished");
@ -94,7 +92,9 @@ public class DownloadObserver extends AsyncTask<Void, Void, Void> {
long downloadId = getDownloadStatus(cursor, long downloadId = getDownloadStatus(cursor,
DownloadManager.COLUMN_ID); DownloadManager.COLUMN_ID);
FeedFile feedFile = requester.getFeedFile(downloadId); FeedFile feedFile = requester.getFeedFile(downloadId);
if (feedFile != null) {
DownloadStatus status = findDownloadStatus(feedFile); DownloadStatus status = findDownloadStatus(feedFile);
if (status == null) { if (status == null) {
status = new DownloadStatus(feedFile); status = new DownloadStatus(feedFile);
statusList.add(status); statusList.add(status);
@ -129,6 +129,7 @@ public class DownloadObserver extends AsyncTask<Void, Void, Void> {
status.successful = false; status.successful = false;
status.statusMsg = R.string.download_cancelled_msg; status.statusMsg = R.string.download_cancelled_msg;
} }
}
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
cursor.close(); cursor.close();
@ -203,6 +204,7 @@ public class DownloadObserver extends AsyncTask<Void, Void, Void> {
public interface Callback { public interface Callback {
public void onProgressUpdate(); public void onProgressUpdate();
public void onFinish(); public void onFinish();
} }