gpt4 book ai didi

从给定地址获取纬度和经度的android问题

转载 作者:行者123 更新时间:2023-11-29 02:12:25 25 4
gpt4 key购买 nike

我正在尝试从用户给定的地址中查找纬度和经度,因为我正在使用以下代码,

GeoPoint pointForEnterAddr;


try {

List<Address> address = coder.getFromLocationName(enterAddr, 1);

if (address == null)

pointForEnterAddr = null;

else {
Address location = address.get(0);
System.out.println("Lat in button click :"
+ location.getLatitude());
System.out.println("Long in button click :"
+ location.getLongitude());


pointForEnterAddr = new GeoPoint((int) (location.getLatitude() * 1E6),
(int) (location.getLongitude() * 1E6));


}
catch (Exception ex) {
System.out.println("Error here :" + ex);
}

但每次它捕捉到部分并显示异常时,java.io.IOException: 服务不可用

我怎样才能解决它并获得正确的输出?请告诉我。

谢谢

最佳答案

我为你的问题找到了这个,我认为这是模拟器的错误。看看这个答案

Android; Geocoder, why do I get "the service is not available"?

关于从给定地址获取纬度和经度的android问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6476371/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com