我在数据库项目中有6条记录。 For循环读取每条记录,然后检查转换为动态数组的结果。 但是 For循环无法继续直到结束! For循环检查第三条记录!for()循环不会持续
int count = db.count_field("location", "id");
geoAttrs = new ArrayList<StructureGeo>();
StructureGeo geo = new StructureGeo();
for (int i = 0; i < count; i++) {
geo.lat = db.get_lat("location", i);
geo.lang = db.get_log("location", i);
geo.result = gps2m(latitude, longitude, geo.lat, geo.lang);
geoAttrs.add(geo);
Log.i("LOG", "Array Index #" + i + " = " + geoAttrs.get(i));
}
db.close();
}
编辑:
敬酒代码之后:
int count = db.count_field("location", "id");
和结果:
帖子总计方法.. –
循环前检查您的计数大小。 – Razgriz
请再检查一次......我把照片放在烤面包上 – Developer