緯度と経度を使用して場所(例:地域、国、郵便番号)の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