Java tutorial
//package com.java2s; //License from project: Open Source License import android.database.Cursor; import java.util.ArrayList; public class Main { public static ArrayList<String> cursorToArrayList(Cursor cursor) { ArrayList<String> list = new ArrayList<>(); if (cursor == null) return list; cursor.moveToFirst(); while (!cursor.isAfterLast()) { list.add(cursor.getString(0)); cursor.moveToNext(); } return list; } }