我正在尝试在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> gclist ;
        gclist  = mygeocoder.getFromLocationName(inputaddress,1);

09-10 12:56
查看更多