尋找我和朋友之間最近的距離 (Finding nearest distance between me and friends)


問題描述

尋找我和朋友之間最近的距離 (Finding nearest distance between me and friends)

我需要在 android.now 我有我的當前位置,我的意思是緯度、經度和朋友位置集找到最近的位置。我需要找到離我最近的朋友?誰能建議我如何在android中做到這一點?


參考解法

方法 1:

Use Location class. It has a method called distanceTo(Location loc) to calculate the distance between two Locations.

Location myLocation = new Location("LocProvider");
myLocation.setLatitude(latitude);
myLocation.setLongitude(longitude);

//Same as above, Setup friendLocation 

float distance = myLocation.distanceTo(friendLocation);

Doc : http://developer.android.com/reference/android/location/Location.html#distanceTo(android.location.Location)

(by user3675519balachandarkm)

參考文件

  1. Finding nearest distance between me and friends (CC BY‑SA 2.5/3.0/4.0)

#google-latitude #latitude-longitude #Android






相關問題

Otentikasi permanen Google Latitude API untuk akun tertentu (Google Latitude API permanent auth for specific account)

無法從 Google Apps 腳本連接到 Google Latitude API (Can't connect to Google Latitude API from Google Apps Script)

如何在谷歌地圖API中獲取高速公路和道路的緯度和經度 (How to get Latitude and Longitude of highways and roads in Google maps API)

如何修復谷歌地圖上的標記並移動地圖? (How to fix marker on google map and move map?)

使用 Google Latitude API 獲取朋友的位置 (Using Google Latitude API to get friends' locations)

尋找我和朋友之間最近的距離 (Finding nearest distance between me and friends)







留言討論