我從數(shù)據(jù)庫中檢索信息,這些信息都存在指針內(nèi)。現(xiàn)在我需要去指針中的每個項目來檢索信息然后顯示在頁面上。Cursor c = mDbHelper.fetchSpot(15);
startManagingCursor(c);
double lat = Double.parseDouble(c.getString(c.getColumnIndexOrThrow(ParkingSpotDBAdapter.KEY_LAT)));
double lng = Double.parseDouble(c.getString(c.getColumnIndexOrThrow(ParkingSpotDBAdapter.KEY_LNG)));
String name = c.getString(c.getColumnIndexOrThrow(ParkingSpotDBAdapter.KEY_ADDRESS));我用fecthAllSpots()方法可以在指針中返回很多項目,如何在指針中的項目里檢索信息呢?
3 回答

繁華開滿天機(jī)
TA貢獻(xiàn)1816條經(jīng)驗 獲得超4個贊
while(c.moveToNext()){ double lat = Double.parseDouble(c.getString(c.getColumnIndexOrThrow(ParkingSpotDBAdapter.KEY_LAT))); double lng = Double.parseDouble(c.getString(c.getColumnIndexOrThrow(ParkingSpotDBAdapter.KEY_LNG))); String name = c.getString(c.getColumnIndexOrThrow(ParkingSpotDBAdapter.KEY_ADDRESS)); }
添加回答
舉報
0/150
提交
取消