You have to create a Java model class. It should have fields for all columns of your table.
Then iterate through the cursor row by row. For each row, get all the columns from the cursor and create your model object. Then add that object to the ArrayList.
Java model class:
public class MyData {
String column1;
String column2;
public MyData(String column1, String column2){
this.column1 = column1;
this.column2 = column2;
}
}
iterating the cursor and adding to the list:
List<MyData> list = new ArrayList<>();
while(cursor.moveToNext()) {
String column1 = cursor.getString(cursor.getColumnIndex(COLUMN_NAME1));
String column2 = cursor.getString(cursor.getColumnIndex(COLUMN_NAME2));
MyData data = new MyData(column1, column2);
list.add(data);
}
Update:
If you dont want to have a Java model class, you can use List of Lists.
List<List> outerList = new ArrayList<>();
List<Object> innerList = new ArrayList<>();
while(cursor.moveToNext()) {
String column1 = cursor.getString(cursor.getColumnIndex(COLUMN_NAME1));
String column2 = cursor.getString(cursor.getColumnIndex(COLUMN_NAME2));
innerList.add(column1);
innerList.add(column2);
outerList.add(innerList);
}
However, I would recommend to use the first method which utilizes the Java model class.