CG's suggestion is best, but you can always calculate it manually with
the Haversine formula if you feel like it. Here's a code snippet if
you're interested:

         double dist = 0.0;
         double deltaLat = Math.toRadians(latVal2 - latVal1);
         double deltaLon = Math.toRadians(lonVal2 - lonVal1);
         latVal1 = Math.toRadians(latVal1);
         latVal2 = Math.toRadians(latVal2);
         lonVal1 = Math.toRadians(lonVal1);
         lonVal2 = Math.toRadians(lonVal2);
         double earthRadius = 6371;
         double a = Math.sin(deltaLat/2) * Math.sin(deltaLat/2) +
Math.cos(latVal1) * Math.cos(latVal2) * Math.sin(deltaLon/2) * Math.sin
(deltaLon/2);
         double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
         dist = earthRadius * c;

On Aug 9, 4:52 am, Honest <[email protected]> wrote:
> Hello,
>
> I want to know that how can i calculate distance between two point
> using their latitude and longitude in android ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to