Geocoder.isPresent() undefined for the type Geocoder

懵懂的女人 提交于 2019-12-22 09:31:00

问题


My Android and Java skills aren't so hot...

In the developer.android.com page for Geocoder, it says :

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.

However, when I try to call, for example :

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

Eclipse tells me

The method isPresent() is undefined for the type Geocoder

How can I "use the isPresent() method"?


回答1:


public static boolean isPresent () method only available from API level 9, It means you should use Android 2.3 or latter version for that. Make sure you are using that. Then check Eclipse project configuration for Android SDK.

Reference: http://developer.android.com/reference/android/location/Geocoder.html



来源:https://stackoverflow.com/questions/5707685/geocoder-ispresent-undefined-for-the-type-geocoder

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