Reputation: 309
I'm trying to find the address(location) using Geocoder.
I have the following code:
double lat = (double) (coord.getLat() * (1e-6));
double lon = (double) (coord.getLon() * (1e-6));
try {
List<Address> list = geocoder.getFromLocation(lat, lon,1);
if (list != null && list.size() > 0) {
Address address = list.get(0);
result = address.getAddressLine(0) + ", "
+ address.getLocality();
}
System.out.println("adresa returnata folosind geocoder:"
+ result);
}
The data that I pass to geocoder is in this format:
2.449548 48.950518
But when trying to println()
the first address returned by Geocoder it returns null. This is how my logcat looks like:
reverseGeocode()`: no feature in GLocation
And my System.out.println()
displays :null
. I have internet acces and also internet permssion added to my manifest file. Does someone know what I'm doing wrong??
Upvotes: 1
Views: 626
Reputation: 5208
As Geobits said, your coordinates belong to place in the Arabian Sea. You cant get an Address from there, so your list is empty and your result is null.
Upvotes: 1