这是失败的行:
adds = geo.GetFromLocation(location.GetLatitude(), location.GetLongitude(), 1)
geo.GetFromLocation
返回 Java.Util.IList<Address>
. adds
是类型 Address
. 。因此,编译错误。
使用索引操作员访问其中一个地址。
编辑
另外,您应该初始化 geo
在使用之前:
Geocoder geo = new Geocoder(this, Locale.getDefault());
最后,getFromlocation可以返回null或空列表,因此请检查两者。