Questions tagged [mergecursor]
12 questions
37
votes
2 answers
When to use CursorJoiner / MatrixCursor / MergeCursor?
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…

Jodes
- 14,118
- 26
- 97
- 156
5
votes
1 answer
Android: Add column to already populated Cursor
I'm confused about whether to use MergeCursor or CursorJoiner.
I have a Cursor (A) with a load of data in it. Lets say there are 100 rows in Cursor (A) and 3 columns. What I want to do is insert (append) a new column to the Cursor so the resulting…

SparkyNZ
- 6,266
- 7
- 39
- 80
4
votes
1 answer
Android ListView not refreshing after change cursor
the following code is used to populate an endless ListView.
When the user reach the end of the list, the app call the async task to get more items, then on post execute the new cursor is returned and merged with the previous.
The problem is this…

rodrigocoelho
- 128
- 3
- 10
4
votes
1 answer
Using MergeCursor and a SimpleCursorAdapter, What's Missing?
No matter what I do, the following throws an error that one of the columns contained in the cursor_counterparty does not exist. When I checked the merge_cursor, I can find the column in there, here's my code, what am I doing wrong?
cursor_invoices =…

AutoM8R
- 3,020
- 3
- 32
- 52
3
votes
1 answer
Showing heterogenous data in a listview from two tables in Android
I have two totally unrelated tables Notes and Tasks. I need to show both of them together in a combined list view. To achieve this, the combined cursor given to list adapter should have a FULL OUTER JOIN of the two tables.
I am not sure which of…

Yagna
- 423
- 1
- 5
- 15
3
votes
2 answers
Merging cursors during onLoadFinished() causes StaleDataException after rotation
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 loader, Cursor cursor)
{
// If we've…

IAmKale
- 3,146
- 1
- 25
- 46
3
votes
4 answers
Using cursor.respond(Bundle) & cursor.getextras()
I am having 2 cursors from different tables in an SQLite database. I am trying to put the data from the two cursors into one ListView but for different formatting for data from each cursor.
What I thought about is using a MergeCursor to combine both…

Mohamed_AbdAllah
- 5,311
- 3
- 28
- 47
2
votes
0 answers
Finding a distinction which row is from which cursor?
I have used MergeCursor in my code, two loaders give two cursors. First one loads all audios from External_Content_Uri and Second one from Internal_Content_Uri.
The Problem is when I merge both these cursors and populate a List with audios, and I…

Shoaib Anwar
- 1,555
- 12
- 26
2
votes
1 answer
listview setItemChecked not working properly
I am having an issue with a listview populated by a merge cursor.
I have a button in my application to select all the entries in my listview. The function called when the button is pressed is the following:
private void selectAllEntries() {
int…

sakis kaliakoudas
- 2,039
- 4
- 31
- 51
1
vote
1 answer
How to combine data from two database tables into one listView
I am quite confused about how to combine two separate database queries into one listView.
Currently, my listView is populated by the following adapter which queries the damaged component table in my database and provides a list of damaged components…

Scamparelli
- 756
- 1
- 12
- 28
0
votes
1 answer
MergeCursor not updating after data change
I'm creating a MergeCursor like so:
@Override
public Cursor loadInBackground() {
Log.d(LOG, "loading data in background");
ContentResolver cr = getContext().getContentResolver();
Cursor people =…

Warblr
- 1,188
- 1
- 13
- 27
0
votes
1 answer
CursorIndexOutOfBounds with MergeCursor and ContentProvider
I return a MergeCursor Instance from my content provider, wrapping a cursor from same content provider. Sounds weird, but I need it for data aggregation. Here is the code:
Cursor filteredLatest =…

Eugene
- 656
- 8
- 20