위도와 경도를 사용하여 을 (예 : 지역, 국가, 우편 번호) Google지도 모양을 얻으려고합니다. 다음은 널 (null) 데이터를 가지고 내 코드입니다 :위치를 사용하여 Google지도에서 장소를 가져올 수 없습니다.
편집 : 수동으로 위도와 경도를 할당하려고했으나 아무것도 없어
public void onLocationChanged(Location location) {
geocoder = new Geocoder(this, Locale.getDefault());
if (location != null) {
try {
addresses = geocoder.getFromLocation(location.getLatitude()/1E6,
location.getLongitude()/1E6, 1);
if (addresses.size() > 0) {
resultAddress = addresses.get(0);
locality = resultAddress.getLocality();
sublocality = resultAddress.getSubLocality();
postalcode = resultAddress.getPostalCode();
country = resultAddress.getCountryName();
adminarea = resultAddress.getSubAdminArea();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
.
누구든지 내 실수를 바로 잡을 수 있습니까? 감사합니다.
오류가 있습니까? – Finuka