я исследовал это часами, и единственные ответы, которые я вижу, указывают мне на
http://developer.android.com/reference/android/location/Location.html
и использовать метод
public static void distanceBetween (double startLatitude, double startLongitude, double endLatitude, double endLongitude, float [] результаты)
Мне нужна помощь, чтобы понять, как это работает по отношению к моему приложению. вот как я получаю свое местоположение.
LocationManager locationManager;
String context = Context.LOCATION_SERVICE;
locationManager = (LocationManager)getSystemService(context);
String provider = LocationManager.GPS_PROVIDER;
Location location = locationManager.getLastKnownLocation(provider);
updateWithNewLocation(location);
}
private void updateWithNewLocation(Location location) {
String latLongString;
TextView myLocationText;
myLocationText = (TextView)findViewById(R.id.myLocationText);
if (location != null) {
double lat = location.getLatitude();
double lng = location.getLongitude();
latLongString = "Lat:" + lat + "\nLong:" + lng;
} else {
latLongString = "No location found";
}
myLocationText.setText("Your Current Position is:\n" +
latLongString);
}
Может ли кто-нибудь помочь мне немного разобраться, как импортировать мое текущее местоположение в это уравнение, а затем отобразить расстояние, указанное в моем приложении?
спасибо