Gerard_jcr Asked: 2020-08-13 08:28:53 +0800 CST 2020-08-13 08:28:53 +0800 CST 2020-08-13 08:28:53 +0800 CST How to Convert ArrayList<String> to Cursor Java Android 772 How can I pass an ArrayList to a cursor with its fields? java 2 Answers Voted Best Answer Jorgesys 2020-08-13T09:41:57+08:002020-08-13T09:41:57+08:00 One option would be to use the MatrixCursor , adding the values of the ArrayListinside the cursor. MatrixCursor myMatrixCursor = new MatrixCursor(myArrayList.size()); startManagingCursor(myMatrixCursor); //Agrega valores de ArrayList en el Cursor. matrixCursor.addRow(new Object[] {myArrayList.get(0), myArrayList.get(1), myArrayList.get(2), myArrayList.get(3), ..... }); Then we add the values to the cursor from the created MatrixCursor. MergeCursor mergeCursor = new MergeCursor(new Cursor[] { matrixCursor, cursor }); Dan 2020-08-13T08:59:09+08:002020-08-13T08:59:09+08:00 It seems to me that you can use MatrixCursor. It is an implementation of Cursor, it is mutable and can be used newRow()to add new rows. I hope it helps, sorry I haven't tried it.
One option would be to use the MatrixCursor , adding the values of the
ArrayList
inside the cursor.Then we add the values to the cursor from the created MatrixCursor.
It seems to me that you can use
MatrixCursor
. It is an implementation of Cursor, it is mutable and can be usednewRow()
to add new rows.I hope it helps, sorry I haven't tried it.