制作一个定位对象的Android与纬度和经度值 [英] Making a Location object in Android with latitude and longitude values
问题描述
予具有其中一个位置的纬度和经度值存储在数据库中,这是我下载一个程序。
I have a program in which latitude and longitude values of a location are stored in a database, which I download.
我想获得这些坐标之间的距离,和我现在的位置。
I want to get the distance between these coordinates, and my current location.
该位置类有一个简单的方法来找到两个位置的物体之间的距离,所以我想我会做一个定位对象的坐标,然后调用方法。
The Location class has a simple method to find the distance between two Location objects, so I figured I'd make a Location object with the coordinates, then call the method.
有没有一种简单的方法来做到这一点?此外,如果有另外一个可靠的,非常简单的公式,不会弄乱的东西太多了,那工作了。谢谢。
Is there an easy way to do this? Also, if there's another reliable, fairly simple equation that won't clutter things too much, that would work too. Thanks.
(android.location.Location)
(android.location.Location)
推荐答案
您是否在寻找<一href="http://developer.android.com/reference/android/location/Location.html#distanceBetween%28double,%20double,%20double,%20double,%20float%5B%5D%29">this?
这似乎并不真正需要做的地点类,所以可能更适合你
It doesn't seem to require actually making a location class so might be more suited to you
修改请参阅下面的答案。这是更好
Edit Please see the answer below. It's much better
这篇关于制作一个定位对象的Android与纬度和经度值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!