简体   繁体   中英

Geocoder.isPresent() undefined for the type Geocoder

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"?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM