mergecursor

When to use CursorJoiner / MatrixCursor / MergeCursor?

我怕爱的太早我们不能终老 提交于 2020-01-28 13:15:52
问题 I'm exploring different ways to get data elegantly from two or more joined tables. I believe MergeCursor , (Android Developer Guide) seems to imply that could (for example) replace an equivalent SQL UNION by concatenating two queries (or adding views individually as rows, etc) - so, not what I want. But I'm at a loss as to what exactly CursorJoiner and MatrixCursor are for, or how to use them. I've looked at the source for them and (as usual) it means nothing to me! The examples I've found of

Merging cursors during onLoadFinished() causes StaleDataException after rotation

白昼怎懂夜的黑 提交于 2019-12-07 13:30:49
问题 I'm loading some results from a database using a loaderManager. Unfortunately, the following code produces a StaleDataException after rotating the device: @Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { // If we've returned results, then pass them and the webSearches cursor along to be displayed if(cursor.moveToFirst()) { // Get a cursor containing additional web searches and merge it at the end of the results cursor MatrixCursor searchesCursor =

Merging cursors during onLoadFinished() causes StaleDataException after rotation

谁都会走 提交于 2019-12-05 22:52:38
I'm loading some results from a database using a loaderManager. Unfortunately, the following code produces a StaleDataException after rotating the device: @Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { // If we've returned results, then pass them and the webSearches cursor along to be displayed if(cursor.moveToFirst()) { // Get a cursor containing additional web searches and merge it at the end of the results cursor MatrixCursor searchesCursor = getWebSearchesCursor(searchTerm, false); Cursor[] cursors = { cursor, searchesCursor }; // TODO: Figure out why merging

When to use CursorJoiner / MatrixCursor / MergeCursor?

五迷三道 提交于 2019-11-29 19:52:11
I'm exploring different ways to get data elegantly from two or more joined tables. I believe MergeCursor , ( Android Developer Guide ) seems to imply that could (for example) replace an equivalent SQL UNION by concatenating two queries (or adding views individually as rows, etc) - so, not what I want. But I'm at a loss as to what exactly CursorJoiner and MatrixCursor are for, or how to use them. I've looked at the source for them and (as usual) it means nothing to me! The examples I've found of them in use didn't clearly explain what the resulting effect was. I would really appreciate a good