How to get miles/km and minus from current location to latitude/longitude destination in google maps API V2. If i get this value I want to store in textview.
My code is:
import android.os.Bundle;
import com.actionbarsherlock.app.SherlockActivity;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class DetailMapActivity extends SherlockActivity {
private GoogleMap map;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_detail_map);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
map.setMyLocationEnabled(true);
LatLng LOC_DESTINATION = new LatLng(-6.33438, 106.74316);
map.addMarker(new MarkerOptions().position(LOC_DESTINATION)
.title("Destination Title").snippet("Destination Description"));
map.moveCamera(CameraUpdateFactory.newLatLngZoom(LOC_DESTINATION, 40));
map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
String miles = "what this code?";
Log.d("HaichalMap", miles);
}
}
Thanks for answer.