java - Geocoder.isPresent() 未定义 Geocoder 类型

标签 java android google-geocoder

我的 Android 和 Java 技能不是很好......

在 Geocoder 的 developer.android.com 页面中,它说:

The Geocoder query methods will return an empty list if there no backend service in the platform. Use the isPresent() method to determine whether a Geocoder implementation exists.

但是,当我尝试调用时,例如:

if (Geocoder.isPresent()) {...

Eclipse 告诉我

The method isPresent() is undefined for the type Geocoder

如何“使用 isPresent() 方法”?

最佳答案

public static boolean isPresent () 方法仅适用于 API 级别 9,这意味着您应该使用 Android 2.3 或更高版本。确保你正在使用它。然后检查 Android SDK 的 Eclipse 项目配置。

引用:http://developer.android.com/reference/android/location/Geocoder.html

关于java - Geocoder.isPresent() 未定义 Geocoder 类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5707685/

相关文章:

java - 将变量保留在 session 范围内而不将其设为静态?

java - 使用Jackson将java对象转换为InputStream(用于上传到S3)?

java - 为什么我的电子邮件 EditText 保存在我的昵称 EditText 上?

android - 更改 Fragment 中的 TextView

android - Twitter 应用程序中的身份验证卡在 android 中的 Pin

java - android 共享首选项和 map

google-maps - 谷歌地理编码 API 为网络标准化地址返回 ZERO_RESULTS

javascript - 在 Javascript 变量(和 googlemaps 地理编码器)上使用 split()

java - Jackson 从子节点反序列化到字段?

python - Google Geocode api 不返回某些 'direct hit' 地址的 postal_code