데이터베이스 프로젝트에 6 개의 레코드가 있습니다. 각 레코드를 읽고 동적 배열로 전환 한 결과를 확인하는 루프입니다. 그러나 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