Merge "Release resources for a previously loaded cursor if a new one comes in."

This commit is contained in:
Ben Komalo
2010-07-23 11:59:15 -07:00
committed by Android (Google) Code Review

View File

@@ -55,8 +55,13 @@ public class CursorLoader extends AsyncTaskLoader<Cursor> {
}
return;
}
Cursor oldCursor = mCursor;
mCursor = cursor;
super.deliverResult(cursor);
if (oldCursor != null && !oldCursor.isClosed()) {
oldCursor.close();
}
}
public CursorLoader(Context context, Uri uri, String[] projection, String selection,