안드로이드 개발 질문/답변
(글 수 45,052)
두어시간 검색을 해봤습니다만..
다들 remove(인덱스) or clear 을 쓰시더라구요..
근데 저는 두개를 해도 안되네요..
소스 올립니다..
그냥 suchtype가 0일때는 디비에서 긁어온거 다 그려주고... 1일때는 저 조건에서 검색되는
단 한개의 마커를 뿌리는데요..
현재 모든 경우의 마커를 뿌릴때 나머지가 삭제가 안되고 있는 문제가 있습니다...
어떤 해결방법이 없을까요...;;
public StiesOverlay_store(Drawable marker, Context context, LinearLayout linear, int suchtype) { super(marker); this.linear = linear; if (suchtype == 0) { String sql = "select * from store"; cursor = NanumLottoDB.rawQuery(sql, null); for (int i = 0; cursor.moveToNext(); i++) { zip[i] = cursor.getString(2); sName[i] = cursor.getString(3); Address1[i] = cursor.getString(4); Address2[i] = cursor.getString(5); Address3[i] = cursor.getString(6); Address4[i] = cursor.getString(7); Address5[i] = cursor.getString(8); telephone[i] = cursor.getString(9); ThisLat[i] = Double.parseDouble(cursor.getString(10)); ThisLot[i] = Double.parseDouble(cursor.getString(11)); Location.distanceBetween(p.lat(), p.lot(), ThisLat[i], ThisLot[i], result); if (result[0] / 1000 < 30) { storeLat[i] = ThisLat[i]; storeLot[i] = ThisLot[i]; count++; } } // 상점 위치~ for (int i = 0; i < dbRowCount; i++) { Location.distanceBetween(p.lat(), p.lot(), ThisLat[i], ThisLot[i], result); if (result[0] / 1000 < 30) { items.add(new OverlayItem(getPoint(storeLat[i], storeLot[i]), sName[i], Address1[i] + " " + Address2[i] + " " + Address3[i] + " " + Address4[i] + " " + Address5[i] + "\n" + TransTelephone(telephone[i]))); } } populate(); } else if (suchtype == 1) { String sql = "select * from store where (address1 ='" + si_do + "'and address2 = '" + gu_gun + "' and s_name ='" + reS_name + "') group by s_name"; cursor = NanumLottoDB.rawQuery(sql, null); while (cursor.moveToNext()) { Log.i("asdasdasd", cursor.getString(3)); map.getController().setCenter( getPoint(Double.parseDouble(cursor.getString(10)), Double.parseDouble(cursor.getString(11)))); Log.i("add before", cursor.getString(9)); items.add(new OverlayItem(getPoint( Double.parseDouble(cursor.getString(10)), Double.parseDouble(cursor.getString(11))), cursor .getString(3), cursor.getString(4) + " " + cursor.getString(5) + " " + cursor.getString(6) + " " + cursor.getString(7) + " " + cursor.getString(8) + "\n" + TransTelephone(cursor.getString(9)))); Log.i("add after", cursor.getString(1)); Log.i("add after", cursor.getString(2)); Log.i("add after", cursor.getString(3)); Log.i("add after", cursor.getString(4)); Log.i("add after", cursor.getString(5)); Log.i("add after", cursor.getString(6)); Log.i("add after", cursor.getString(7)); Log.i("add after", cursor.getString(8)); Log.i("add after", cursor.getString(9)); Log.i("add after", cursor.getString(10)); } populate(); AnimationTool.moveForward(map, storeLocation); } }