下面是我的代码,它给出了用户的硬编码 lat long 我想显示动态 latlong 用户去哪里地图显示用户的当前位置怎么做?
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_support_map_fragment);
FragmentManager fmanager = getSupportFragmentManager();
Fragment fragment = fmanager.findFragmentById(R.id.map);
SupportMapFragment supportmapfragment = (SupportMapFragment)fragment;
GoogleMap supportMap = supportmapfragment.getMap();
LatLng latLng = new LatLng(24.89337, 67.02806);
supportMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
supportMap.addMarker(new MarkerOptions()
.position(latLng)
.title("My Spot")
.snippet("This is my new spot!")
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));
supportMap.getUiSettings().setCompassEnabled(true);
supportMap.getUiSettings().setZoomControlsEnabled(true);
supportMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 20));
}