SQLite whole column with numbers convert to plain int, because I want to perform a calculation.
I get a whole of data from one column by convert data to ArrayList<String> and is there any simpler way to do this instead steps: ArrayList<String> -> ArrayList<int> -> int?
public ArrayList<String> GetAllValues(String aTable,String[] aColumn)
{
SQLiteDatabase db = this.getWritableDatabase();
ArrayList<String> list = new ArrayList<String>();
Cursor cursor = db.query(aTable, aColumn, null, null, null, null, null);
if (cursor.moveToFirst())
{
do
{
list.add(cursor.getString(0));
}
while (cursor.moveToNext());
}
if (cursor != null && !cursor.isClosed())
{
cursor.close();
}
return list;
}
Aucun commentaire:
Enregistrer un commentaire