本文介绍了查找Android的两个位置之间的距离?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:结果 Distance从我的位置计算到目标位置的Android
我很新的谷歌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的两个位置之间的距离?
发布评论