dimanche 6 septembre 2015

Android sqlite get number of single row

from my table I want to get the number of each row. For example, if I have 5 rows, I want to get 1,2,3,4,5. I have this method, but I get only the number 1. Thanks for help.

private void listaAvvio() {
SQLiteDatabase db = new DatabaseHelper(getActivity()).getReadableDatabase();
final List<Dettaglio1> dettagli1 = new ArrayList<Dettaglio1>();
String tabella_op = "SELECT .....";
 Cursor cur = db.rawQuery(tabella_op, null);
    while (cur.moveToNext()) {
Dettaglio1 d1 = new Dettaglio1();
        d1.id = cur.getString(0);
        d1.FIELD1= cur.getString(1);
        d1.FIELD2= cur.getString(2);
        d1.FIELD3= cur.getString(3);
        d1.NUMBER_OF_SINGLE_ROW++;
        dettagli1.add(d1);
}
    cur.close();
    db.close();
...
...
}

Aucun commentaire:

Enregistrer un commentaire