Android光标接下来

时间:2013-08-16 16:46:47

标签: java android database

我在android中有这个数据库打印机。 enter image description here

Cursor curTAB = myDataBase.rawQuery("SELECT * FROM  GPS_Values;", null);

Integer count = 0;
while (curTAB.moveToNext()) {
    String s_latitude = curTAB.getString(1);
    String s_longitude = curTAB.getString(2);
    String s_speed = curTAB.getString(5);
    count++;

    String next_speed = ???

}
curTAB.close();
myDataBase.close();

我想知道如何在循环中获得下一个速度?

1 个答案:

答案 0 :(得分:6)

while (curTAB.moveToNext()) {
    String s_latitude = curTAB.getString(1);
    String s_longitude = curTAB.getString(2);
    String s_speed = curTAB.getString(5);
    count++;
    int position = curTAB.getPosition();

    if(curTAB.moveToNext()) {
        String next_speed = curTAB.getString(5);
        curTAB.moveToPosition(position);
    }
}

应该有用,我会说。