Geocoder를 이용해 위도 경도를 잡고 주소값을 불러오려고 합니다.

 

logcat으로 확인해보면 위도, 경도는 잡히는데 그 값에 맞춰 주소값을 불러오지 못하고 있습니다.

 

고수님들 왜 그러는지 좀 알려주세요~~

 

locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 5, this);       
        //locManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000, 5, this);
      
       
        geoCoder = new Geocoder(this, Locale.KOREAN);  
        GetLocations();

 

 public void GetLocations() {
         TextView jusoText = (TextView) findViewById(R.id.gps);
         StringBuffer juso = new StringBuffer();

         if (myLocation != null) {
          latPoint = myLocation.getLatitude();
          lngPoint = myLocation.getLongitude();

          try {
           List<Address> addresses;
           addresses = geoCoder.getFromLocation(latPoint, lngPoint, 1);
           for(Address addr: addresses){
            int index = addr.getMaxAddressLineIndex();
            for(int i=0;i<=index;i++){
             juso.append(addr.getAddressLine(i));
            }
            juso.append(addr.getLocality()).append(" ");
            juso.append(addr.getPostalCode()).append(" ");
            juso.append(addr.getCountryName());

           }
          } catch (IOException e) {
           e.printStackTrace();
          }
          
         }

         jusoText.setText(String.valueOf(juso));
        }

 @Override
 protected void onResume(){
  super.onResume();
  Location mLocation = locManager .getLastKnownLocation(LocationManager.GPS_PROVIDER);
 }
  public void onLocationChanged(Location location) {
   
   myLocation = location;
   
  }

  public void onProviderDisabled(String provider) {
   // TODO Auto-generated method stub
   
  }

  public void onProviderEnabled(String provider) {
   // TODO Auto-generated method stub
   
  }