Hey Guys i created one Android google map api v2, and now i want to add user current location in map,so can anyone help me for it?
here is my code
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GoogleMap googleMap;
googleMap = ((SupportMapFragment)(getSupportFragmentManager().findFragmentById(R.id.map))).getMap();
LatLng latLng = new LatLng(-33.796923, 150.922433);
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
googleMap.addMarker(new MarkerOptions()
.position(latLng)
.title("My Spot")
.snippet("This is my spot!")
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));
// googleMap.getUiSettings().setCompassEnabled(true);
// googleMap.getUiSettings().setZoomControlsEnabled(true);
// googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 10));
} }
0 comments:
Post a Comment