Scroll indicator done
728x90

@Override
public void onMapReady(@NonNull NaverMap naverMap) {
    this.mNaverMap = naverMap;
    Marker marker = new Marker();
    naverMap.setLocationSource(mLocationSource);
    
    // 지도 클릭 이벤트 처리
    naverMap.setOnMapClickListener((point, coord) -> {
    
    		// 클릭한 위치의 위경도 : coord.latitude, coord.longitud
            marker.setPosition(new LatLng(coord.latitude, coord.longitude));
            marker.setMap(naverMap);

            // 위경도로 도로명 주소 변환
            g = new Geocoder(this, Locale.KOREA); // 결과가 영어로 나올 시, Locale.KOREA 로 설정
            List<Address> address = null;

            try {
                address = g.getFromLocation(mLatitude, mLongitude, 5);

            } catch(IOException e){
                e.printStackTrace();
                Log.d("test", "입출력이 잘못됨");
            }

            if(address != null){
                if(address.size() == 0){
                    textView2.setText("주소가 나오지 않음");
                } else {
                    Log.d("찾은 주소", address.get(0).toString());
                    textView2.setText(address.get(0).getAddressLine(0));
                }
            }
        });
        
}

 

# 문제점

지번주소로 나올 때, 새주소로 나올 때가 있다..

검색해보니, 건물 안과 건물 밖에 따라 다르게 나올 때 있다고 한다 음..

728x90