android using cursorloader instead of managedQuery
I can use a managedQuery like this:
Activity a = (Activity) context;
cursor = a.managedQuery(uri, null, null, null, null);
And once I do, I have a cursor that I can step through however I want.
However, using a CursorLoader, when a new CursorLoader is created the onCreateLoader call back method is called. The onCreateLoader call back returns a CursorLoader. How do I get a reference to the cursor so I can step though it, as in managedCursor.
I missing the boat here, appreciate an开发者_StackOverflow社区y direction.
You need to also implement onLoadFinished, this method gives you the Cursor when the asynchronous load has finished
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
myadapter.swapCursor(cursor);
}
精彩评论