vergil corleone
vergil corleone

Reputation: 1111

"The constructor Geocoder(Context, Locale) is undefined"?

I am making an android app, and need to use Google maps' reverse geocoding. The relevant code is:

  Geocoder geoCoder = new Geocoder(getApplicationContext(), Locale.getDefault());
  List<Address> matches = geoCoder.getFromLocation(latitude, longitude, 1);
  // latitude and longitude are double variables containing the coordinates.

On the first line of the code above I am getting the compiling error:

"The constructor Geocoder(Context, Locale) is undefined"

I tried googling but could not find a resolution. Thanks.

Upvotes: 1

Views: 1427

Answers (1)

Blackbelt
Blackbelt

Reputation: 157467

The constructor Geocoder(Context, Locale) is defined. Check if you import the correct class

 android.location.Geocoder

here the documentation

Upvotes: 1

Related Questions