2013-08-16 37 views
1

我有這個數據庫打印機在android。 enter image description hereAndroid遊標得到下一個

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(); 

,我想知道如何得到循環的下速度?

+0

表格的結構如何? –

+0

更新了問題 – David

回答

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); 
    } 
} 

應該工作,我會說。

+0

它工作一次。但是在每次計數增加時我都需要它 – David

+0

您是否注意到我的位置編輯? –

+0

非常感謝你! :) – David