Calculate distance between two points latitude and longitude in Android
Selasa, 17 September 2013
0
komentar
Use this method with following parameters
public double Calculate_Distance(Double latB, Double longB,
Double latA, Double longA) {
double distance;
Location locationA = new Location("point A");
locationA.setLatitude(latA);
locationA.setLongitude(longA);
Location locationB = new Location("point B");
locationB.setLatitude(latB);
locationB.setLongitude(longB);
distance = locationA.distanceTo(locationB);
return distance;
}
Then use this below code in your activity
Double total_distance = Calculate_Distance(latB,longB, latA,
longA);
Returns the approximate distance in meters between this location.
public double Calculate_Distance(Double latB, Double longB,
Double latA, Double longA) {
double distance;
Location locationA = new Location("point A");
locationA.setLatitude(latA);
locationA.setLongitude(longA);
Location locationB = new Location("point B");
locationB.setLatitude(latB);
locationB.setLongitude(longB);
distance = locationA.distanceTo(locationB);
return distance;
}
Constructs the new Location with a named provider. |
Then use this below code in your activity
Double total_distance = Calculate_Distance(latB,longB, latA,
longA);
Returns the approximate distance in meters between this location.
TERIMA KASIH ATAS KUNJUNGAN SAUDARA
Judul: Calculate distance between two points latitude and longitude in Android
Ditulis oleh Unknown
Rating Blog 5 dari 5
Semoga artikel ini bermanfaat bagi saudara. Jika ingin mengutip, baik itu sebagian atau keseluruhan dari isi artikel ini harap menyertakan link dofollow ke https://samsung-galaxy-s2r.blogspot.com/2013/09/calculate-distance-between-two-points.html. Terima kasih sudah singgah membaca artikel ini.Ditulis oleh Unknown
Rating Blog 5 dari 5
0 komentar:
Posting Komentar