Questions tagged [matrixcursor]

MatrixCursor represents a mutable Cursor in the Android platform which is backed by an array of Objects.

MatrixCursor is a mutable cursor implementation on the Android platform. The MatrixCursor requires that the developer must supply an array of Strings to its constructors representing the data columns names. Data can be added to the MatrixCursor either by using one of the newRow(), addRow()'s methods or by using its static RowBuilder class. More information can be found in the documentation of the class.

28 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
21
votes
1 answer

Using MatrixCursor and SimpleCursorAdapter in a ListView with text and images

I'm having an issue using a MatrixCursor to populate my ListView: private void fillData() { String[] menuCols = new String[] { "icon", "item", "price" }; int[] to = new int[] { R.id.icon, R.id.item, R.id.price }; MatrixCursor menuCursor…
Corey D
  • 4,689
  • 4
  • 25
  • 33
8
votes
3 answers

Passing binary blob through a content provider

I have a content provider that is custom to my set of Android applications, and one of the things it needs to expose is a small (20-30 KiB) byte array. The URI for these blobs looks like: content://my.authority/blob/# where # is the row number; the…
6
votes
1 answer

Matrixcursor with non-db content provider

I have a content provider that returns a MatrixCursor for the query() method. Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { MatrixCursor cursor = new MatrixCursor(new String[]{"a","b"}); …
5
votes
1 answer

Using addrow for MatrixCursor, how to add different object types?

I am trying to input data from a List to a cursor. ParseObject documentation can be found here. I found out that you can use MatrixCursor to do this, referring to helpful…
nommer
  • 2,730
  • 3
  • 29
  • 44
3
votes
1 answer

Issues with a MatrixCursor

I have to create a ListView with multiple rows for the same contact if contact has multiple numbers. So a contact having 3 numbers will show as 3 separate rows in the ListView. For that I have created a MatrixCursor for adding separate rows and then…
Rishi
  • 3,499
  • 8
  • 35
  • 54
3
votes
0 answers

Fill a ListView using SimpleAdapter with Maps vs SimpleCursorAdapter with MatrixCursor

My Android application uses a ListView with simple two-line rows. The list is filled in using simple static data. I am aware of two different solutions for filling in the list in these circumstances: 1) Using a SimpleAdapter with an ArrayList of…
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
2
votes
1 answer

Sorting a MatrixCursor in Android

I have a MatrixCursor like this: final String[] matrix = { "_id", "name", "price" }; MatrixCursor data = new MatrixCursor(matrix); data.addRow(new Object[] { i++, name, price }); I have several rows there. I'm looking for a method to sort my…
Martus0
  • 667
  • 1
  • 10
  • 16
2
votes
2 answers

SearchView: Getting the selected item from the suggestion listener

I have a search view that has the suggestions populated by a MatrixCursor (because I already have an array of Strings). However I would like to get which item is being selected by the user. So far I am only able to get the position where the user…
1
vote
1 answer

Difference between list and matrixcursor (Android)

I'm trying to make a new android project in which I collect my data from an online JSON file. If I look on the internet, I can see a lot of examples where they are storing the collected data in a MatrixCursor. Personally, I think it's much easier…
Nike Sprite
  • 476
  • 2
  • 16
1
vote
0 answers

ViewBinder's setViewValue with a MatrixCursor instead of a Cursor

I am using a SimpleCursorAdapter with a MatrixCursor to load data from my server into a listview. I want to customize each item using a ViewBinder. I noticed that setViewValue has the following parameters: setViewValue(View view, Cursor cursor, int…
Pacemaker
  • 1,117
  • 2
  • 17
  • 36
1
vote
1 answer

How to implement a MatrixCursor for a Spinner?

I have a SQLite query that returns a Cursor. I want to add some extra rows to the Cursor by implementing a MatrixCursor(to try to keep the first item of real data from automatically selected when clicked). Then I want to map them to a…
macrogeo
  • 97
  • 1
  • 11
0
votes
1 answer

Making a cursor for use in a ListView

What I am trying to accomplish here is to make a Cursor that could be used in an android ListView. I'm reading values directly from multiple files and have to feed them to the cursor. I tried to use MatrixCursor but I can't get it to work with…
Binoy Babu
  • 16,699
  • 17
  • 91
  • 134
0
votes
1 answer

Optimal way to refresh specific rows in a ListView when using a MatrixCursor

I have a ListView with a custom CursorAdapter feed from a MatrixCursor. Each row in the ListView has an image that is loaded asynchronously, and when the image loading completes, I would like to signal the adapter to redraw the row in question. I do…
Melllvar
  • 2,056
  • 4
  • 24
  • 47
1
2