public List<PointBean> getAllPoints() {
String sql = "select * from points";
SQLiteDatabase db = helper.getWritableDatabase();
List<PointBean> pointList = new ArrayList<PointBean>();
PointBean point = null;
Cursor cursor = db.rawQuery(sql, null);
while (cursor.moveToNext()) {
point = new PointBean();
point.setPointName(cursor.getString(cursor
.getColumnIndex("point_name")));
point.setLongitude(cursor.getDouble(cursor
.getColumnIndex("longitude")));
point.setLatitude(cursor.getDouble(cursor
.getColumnIndex("latitude")));
pointList.add(point);
}
return pointList;
}
Android Cursor遍历
最新推荐文章于 2021-05-29 02:57:05 发布