3

我的 Android 和 Java 技能不那么火爆……

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

如果平台中没有后端服务,Geocoder 查询方法将返回一个空列表。使用 isPresent() 方法确定是否存在 Geocoder 实现。

但是,当我尝试打电话时,例如:

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

日食告诉我

对于 Geocoder 类型,方法 isPresent() 未定义

我怎样才能“使用 isPresent() 方法”?

4

1 回答 1

3

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

参考:http: //developer.android.com/reference/android/location/Geocoder.html

于 2011-04-18T19:35:46.103 回答