查找Android的两个位置之间的距离?

编程入门 行业动态 更新时间:2024-10-20 03:28:09
本文介绍了查找Android的两个位置之间的距离?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

可能重复:结果  Distance从我的位置计算到目标位置的Andr​​oid

我很新的谷歌Android地图我希望两地之间的距离显示。对于我写两个autocompletedtextview我得到的往返位置。通过使用

I am very new to android google maps i want display distance between two places .for that i write the two autocompletedtextview i get the from and to Locations .by using the

public String host = "maps.googleapis"; public String searchPath = "/maps/api/place/autocomplete/json"; public String detailsPath = "/maps/api/place/details/json";

我得到了地方的名称作为字符串我想使用两个字符串的地方我怎么能实现它计算两地之间的距离    先谢谢了。

I got the places names as string i want calculate the distance between two places using that two string places how can i achieve it Thanks in Advance.

推荐答案

我认为这code有用的你:

i think this code usefull for you :

double distance Location locationA = new Location("point A") locationA.setLatitude(latA) locationA.setLongitude(lngA) Location locationB = new Location("point B") locationB.setLatitude(latB) LocationB.setLongitude(lngB) distance = locationA.distanceTo(locationB)

更多推荐

查找Android的两个位置之间的距离?

本文发布于:2023-11-12 20:20:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582439.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:距离   位置   两个   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!