Hi i need to cal an event at onchangelocation(), by comparing current latitude and longitude with some saved latitude and longitude but i m getting an error. eclipse is not
You can use the Location class's static distanceBetween() method like so:
float[] distance = new float[1];
Location.distanceBetween(lat, lon, currentLat, currentLon, distance);
// distance[0] is now the distance between these lat/lons in meters
if (distance[0] < 2.0) {
// your code...
}
If you have two Location objects, another option is distanceTo()