Bug 725540 - Crash on bookmark removal. r=mfinkle

This commit is contained in:
Margaret Leibovic 2012-02-09 12:45:57 -08:00
parent 18e6a2e079
commit 218224006d

View File

@ -247,6 +247,18 @@ public class AwesomeBarTabs extends TabHost {
}
}
// The group cursor doesn't ever need to change because it just holds the
// mobile/desktop folders, but we do need to update the children cursors.
public void refreshBookmarks() {
Cursor groupCursor = mBookmarksAdapter.getCursor();
groupCursor.moveToPosition(-1);
while (groupCursor.moveToNext()) {
String guid = groupCursor.getString(groupCursor.getColumnIndexOrThrow(Bookmarks.GUID));
// We need to do this in a AsyncTask because we're on the main thread
new RefreshChildrenCursorTask(groupCursor.getPosition()).execute(guid);
}
}
private class BookmarksQueryTask extends AsyncTask<Void, Void, Cursor> {
protected Cursor doInBackground(Void... arg0) {
// Make our own cursor to group mobile bookmarks and desktop bookmarks.
@ -837,17 +849,4 @@ public class AwesomeBarTabs extends TabHost {
}
});
}
public void refreshBookmarks() {
new AsyncTask<Void, Void, Cursor>() {
protected Cursor doInBackground(Void... arg0) {
ContentResolver resolver = mContext.getContentResolver();
return BrowserDB.getAllBookmarks(resolver);
}
protected void onPostExecute(Cursor cursor) {
mBookmarksAdapter.changeCursor(cursor);
}
}.execute();
}
}