Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Reverse geocoding - getFromLocation

I am trying to get an address based on the long/lat. it appears that something like this should work?

Geocoder myLocation = Geocoder(Locale.getDefault());     List myList = myLocation.getFromLocation(latPoint,lngPoint,1); 

The issue is that I keep getting : The method Geocoder(Locale) is undefined for the type savemaplocation

Any assistance would be helpful. Thank you.


Thanks, I tried the context, locale one first, and that failed and was looking at some of the other constructors (I had seen one that had mentioned just locale). Regardless,

It did not work, as I am still getting : The method Geocoder(Context, Locale) is undefined for the type savemaplocation

I do have : import android.location.Geocoder;

like image 565
Chrispix Avatar asked Jan 23 '09 09:01

Chrispix


People also ask

Is Android Geocoder free?

The Geocoder use is totally free.

Which class is used for reverse geocoding in Android?

A class for handling geocoding and reverse geocoding. Geocoding is the process of transforming a street address or other description of a location into a (latitude, longitude) coordinate.

Is reverse geocoding API free?

Yes, the Geoapify Reverse Geocoding Tool is Free! You can upload and process multiple locations. No coding and registration required. You can also use Geoapify Reverse Geocoding API and process up to 3000 addresses per day for FREE.


1 Answers

The following code snippet is doing it for me (lat and lng are doubles declared above this bit):

Geocoder geocoder = new Geocoder(this, Locale.getDefault()); List<Address> addresses = geocoder.getFromLocation(lat, lng, 1); 
like image 155
Wilfred Knievel Avatar answered Oct 12 '22 13:10

Wilfred Knievel