I assume that you have a pointer to 20 lines, and now you want to call the method 20 times with a cursor that contains only one line. Here's how you can do it:
Cursor c = ...;
if(c.moveToFirst()){
String[] columns = c.getColumnNames();
while(!c.isAfterLast()){
MatrixCursor newCursor = new MatrixCursor(columns , 1);
MatrixCursor.RowBuilder b = newCursor.newRow();
for(String col: columns){
b.add(c.getString(c.getColumnIndex(col)));
}
}
}
What if the column data type is not a row?
For API> = 11: just call the method getType()in a loop forand use the statement switchto call the corresponding get method.
For API <11: Run another query like this PRAGMA table_info(my_table_name), and then just fill in Mapthe column name and enter it and use in the for loop. Here is how you can read this cursor fooobar.com/questions/657143 / ...
source
share