【发布时间】:2016-07-19 01:22:07
【问题描述】:
我正在尝试在 Android 中使用 google 的 geocoder API。
代码如下:
private void getLatLong(String inputaddress) throws IOException {
Geocoder mygeocoder = new Geocoder(this.getContext());
List<Address> gclist = mygeocoder.getFromLocationName(inputaddress,1);
}
但是,我收到一个错误:
Error: incompatible types: List<android.location.Address> cannot be converted to List<com.google.android.gms.identity.intents.Address>
在声明列表时,我确保它是从 com.google.android.gms.identity.intents.Address 导入的,但我仍然收到此错误。
知道我哪里错了吗?
谢谢。
【问题讨论】:
-
您的 List 声明是一个 android.location.Address 类型。尝试将其更改为 com.google.android.gms.identity.intents.Address
标签: android google-maps google-geocoder