// 클릭 이벤트 설정
// 롱 클릭 이벤트 설정
tMapView.setOnLongClickListenerCallback(new TMapView.OnLongClickListenerCallback() {
@Override
public void onLongPressEvent(ArrayList arrayList, ArrayList arrayList1, TMapPoint tMapPoint) {
bitmap = BitmapFactory.decodeResource(mContext.getResources(), R.mipmap.redpin3);
TMapMarkerItem tourMarkerItem = new TMapMarkerItem();
mapX=tMapPoint.getLongitude();
mapY=tMapPoint.getLatitude();
tpoint = new TMapPoint(mapY, mapX);
tmapdata.convertGpsToAddress(mapY,mapX, new TMapData.ConvertGPSToAddressListenerCallback() {
@Override
public void onConvertToGPSToAddress(String strAddress) {
add=strAddress;
Log.d(TAG,"주소1"+add);
}
});
Log.d(TAG,"주소 2"+add);
tourMarkerItem.setTMapPoint(tpoint);
if(add!=null) {
tMapView.addMarkerItem("tourMarker", tourMarkerItem);
}
tourMarkerItem.setVisible(TMapMarkerItem.VISIBLE);
tourMarkerItem.setIcon(bitmap);
tourMarkerItem.setAutoCalloutVisible(true);
tourMarkerItem.setCalloutTitle("주소");
tourMarkerItem.setCalloutSubTitle(add);
Log.d(TAG,"주소3"+add);///왜 니가먼저야
Toast.makeText(mContext, "마커찍기"+mapY+" "+mapX+""+add, Toast.LENGTH_LONG).show();
}
});
}
}
현재 코드는 이런데 주소값 add 를 뽑아내고싶은데
계속 전에 클릭했던것이 주소가나오길래 log를 찍어봣더니
지금 주소 add 로그가 총 3개 1,2,3 가있습니다.
제가원하는 순서는 주소 1, 주소 2 , 주소 3 이순서인데
이상하게 주소 2 , 주소 3 , 주소 1 이순서로나옵니다…
그래서 주소2 = null
주소 3 = null
주소 1 = 주소123
이렇게나오고 그다음에 실행할땐
주소 2= 주소123
주소 3 = 주소123
주소 1= 새로운주소
이렇게 떠요
이거말고 다른 지오코더도 써봣는데도 계속저렇게나오네요… 뭐가문제인지 알려주시면 감사하겟습니다.