Pet*_*rbo 17 java android area latitude-longitude google-maps-android-api-2
看这个插图:
我想知道的是:
如果您能使用Google Maps API V2为我提供Java代码示例或专门针对Android的代码示例,我更愿意
flx*_*flx 28
你基本上需要的是地图上点之间的距离:
float[] results = new float[1];
Location.distanceBetween(centerLatitude, centerLongitude, testLatitude, testLongitude, results);
float distanceInMeters = results[0];
boolean isWithin10km = distanceInMeters < 10000;
Run Code Online (Sandbox Code Playgroud)
如果您已有Location
对象:
Location center;
Location test;
float distanceInMeters = center.distanceTo(test);
boolean isWithin10km = distanceInMeters < 10000;
Run Code Online (Sandbox Code Playgroud)
以下是该API的有趣部分:https: //developer.android.com/reference/android/location/Location.html
归档时间: |
|
查看次数: |
28107 次 |
最近记录: |