アドレスを取得するには、このコードを試してください。
Geocoder geocoder;
List<Address> addresses;
geocoder = new Geocoder(this, Locale.getDefault());
addresses = geocoder.getFromLocation(latitude, longitude, 1);
String address = addresses.get(0).getAddressLine(0);
String city = addresses.get(0).getAddressLine(1);
String country = addresses.get(0).getAddressLine(2);
オープンストリームマップ用
final String requestString = "http://nominatim.openstreetmap.org/reverse?format=json&lat=" +
Double.toString(lat) + "&lon=" + Double.toString(lon) + "&zoom=18&addressdetails=1";
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(requestString));
try {
@SuppressWarnings("unused")
Request request = builder.sendRequest(null, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == 200) {
String city = "";
try {
JSONValue json = JSONParser.parseStrict(response);
JSONObject address = json.isObject().get("address").isObject();
final String quotes = "^\"|\"$";
if (address.get("city") != null) {
city = address.get("city").toString().replaceAll(quotes, "");
} else if (address.get("village") != null) {
city = address.get("village").toString().replaceAll(quotes, "");
}
} catch (Exception e) {
}
}
}
});
} catch (Exception e) {
}