I need to calculate time and distance between current location to given location using gps.
any one please give idea
final TextView speedView = (TextView) findViewById(R.id.speedtxt);
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
if (location.hasSpeed()) {
float speed = location.getSpeed() * 3.6f;// km/h
speedView.setText(String.format("%.0f km/h", speed));
}
}
public void onProviderDisabled(String provider) {
}
public void onProviderEnabled(String provider) {
}
public void onStatusChanged(String provider, int status, Bundle extras) {
}
};