“The constructor Geocoder(Context, Locale) is undefined”?

空扰寡人 提交于 2019-12-13 02:07:18

问题


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.


回答1:


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

 android.location.Geocoder

here the documentation



来源:https://stackoverflow.com/questions/16593968/the-constructor-geocodercontext-locale-is-undefined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!