开发者

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);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜