如何在谷歌地图 API V2 中获取从当前位置到纬度/经度目的地的英里/公里和减号。如果我得到这个值,我想存储在 textview 中。
我的代码是:
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);
}
}
感谢您的回答。