The following code shows how to get an array of long type values matching the condition.
import org.xmlpull.v1.XmlPullParser; /* w w w . j av a 2 s . c o m*/ import android.content.Context; import android.content.res.XmlResourceParser; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.util.Log; public class DbUtils { private SQLiteDatabase mDb; private Context mContext; private static final String TAG = DbUtils.class.getSimpleName(); /** Get an array of long type values matching the condition**/ public static long[] getAllLongs(SQLiteDatabase db, String table, String column) { Cursor c = db.query(table, new String[] { column }, null, null, null, null, column); if (!c.moveToFirst()) { Log.d(TAG, "Tried to load a long[], but there are none in " + table + "-" + column); c.close(); return null; } long[] toReturn = new long[c.getCount()]; for (int i = 0; i < c.getCount(); i++) { toReturn[i] = c.getLong(c.getColumnIndex(column)); c.moveToNext(); } c.close(); return toReturn; } }