2011-09-21 2 views

답변

1

습니다 고지 .. 이미지도보기의 경우처럼의 위도와 경도를 추적하면 그것은 너무 간단

.

TextView myAddress = (TextView)findViewById(R.id.myaddress); 

     myLatitude.setText("Latitude: " + String.valueOf(LATITUDE)); 
     myLongitude.setText("Longitude: " + String.valueOf(LONGITUDE)); 

     Geocoder geocoder = new Geocoder(this, Locale.ENGLISH); 

     try { 
    List<Address> addresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 1); 

    if(addresses != null) { 
    Address returnedAddress = addresses.get(0); 
    StringBuilder strReturnedAddress = new StringBuilder("Address:\n"); 
    for(int i=0; i<returnedAddress.getMaxAddressLineIndex(); i++) { 
    strReturnedAddress.append(returnedAddress.getAddressLine(i)).append("\n"); 
    } 
    myAddress.setText(strReturnedAddress.toString()); 
    } 
    else{ 
    myAddress.setText("No Address returned!"); 
    } 
} catch (IOException e) { 
    // TODO Auto-generated catch block 
    e.printStackTrace(); 
    myAddress.setText("Canont get Address!"); 
} 

    } 
} 
관련 문제