"构造地质codeR(背景下,区域设置)是未定义的"? [英] "The constructor Geocoder(Context, Locale) is undefined"?

查看:166
本文介绍了"构造地质codeR(背景下,区域设置)是未定义的"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出一个Android应用程序,并需要使用谷歌地图反向地理编码。有关code是:

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.

在code的第一线以上我收到编译错误:

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

构造地质codeR(背景下,区域设置)是未定义

我试着谷歌上搜索,但未能找到解决方案。谢谢你。

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

推荐答案

构造地理codeR(语境,语言环境)定义。检查您是否导入正确的类

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

 android.location.Geocoder

<一个href=\"http://developer.android.com/reference/android/location/Geo$c$cr.html#Geo$c$cr%28android.content.Context,%20java.util.Locale%29\"相对=nofollow>这里文档

这篇关于&QUOT;构造地质codeR(背景下,区域设置)是未定义的&QUOT;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆