database - Android: Accessing DB -
i have following code:
dbadapter dbadapter = new dbadapter(this); dbadapter.open(); arraylist<string> queryresultlist = new arraylist<string>(); cursor cur = dbadapter.db.query("mytable", columns, where, null, groupby, null, null); cur.movetofirst(); while (cur.isafterlast() == false) { queryresultlist.add(cur.getstring(0)); cur.movetonext(); } cur.close(); dbadapter.close();
this code runs on device never run before, i.e. wiped emulator samsung galaxy s device app removed after first trial. means database reading being created first on device. custom database.
on 2.2 runs fine, on 2.1-update1 (api level 7) wont, isafterlast() true, there since api level 1. 1 idea? or idea can figure out?
thanks, a.
hmm, why not use:
cursor cur = ...; while (cur.movetonext()) { queryresultlist.add(cur.getstring(0)); } cur.close();
Comments
Post a Comment