Java tutorial
//package com.java2s; import android.database.Cursor; import java.util.ArrayList; public class Main { public static java.util.List<String> getLabelsFromInt(Cursor c) { c.moveToFirst(); ArrayList<String> res = new ArrayList<>(); for (int i = 0; i < c.getCount(); i++) { res.add(i, String.valueOf(c.getInt(0))); c.moveToNext(); } return res; } }