I think, as you said, you want to refrain from using
any math formula so you can also try this -
You can get the distance from the location address
http://maps.googleapis.com/maps/api/distancematrix/xml?origins="+a+"&destinations="+b+"&mode=driving&language=en-EN&sensor=false with a=addressFrom, b=addressTo
If you have lat, long location, you can get the address of this location as:
double latiTude = 10.3929393; double longiTude = 150.93984884; Geocoder geocoder = new Geocoder(getBaseContext(), Locale.getDefault()); GeoPoint p= new GeoPoint((int) (latiTude * 1E6), (int) (longiTude * 1E6)); List<Address> address = geocoder.getFromLocation( p.getLatitudeE6() / 1E6, p.getLongitudeE6() / 1E6, 1); if (address.size() > 0) { String addressFroLatLong= ""; for (int i = 0; i < address.get(0).getMaxAddressLineIndex(); i++) { addressFroLatLong+= address.get(0).getAddressLine(i) + "\n"; } }
PLease upvote if helped. Nothing more. Thanks, glad to help you enjoy.
source share