prasanna
prasanna

Reputation: 256

Android Google Map v2 Marker Not showing

I'm trying to plot a marker with specific co-ordinates in Google map v2 but it doesnt show the marker on the given Position.

I did go to google but didn't find anything helpful any help please...

    if (googleMap == null) {
            googleMap = ((MapFragment) getFragmentManager().findFragmentById(
                    R.id.map)).getMap();

            // check if map is created successfully or not
            if (googleMap == null) {
                Toast.makeText(getApplicationContext(),
                        "Sorry! unable to create maps", Toast.LENGTH_SHORT)
                        .show();
     double latitude = 13.094192 ;
     double longitude = 80.121689;
     MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title("Hello Maps ");

// adding marker

    googleMap.addMarker(marker);

Upvotes: 0

Views: 7400

Answers (1)

Piyush
Piyush

Reputation: 18933

Change with this:

if (googleMap !=null){
  Marker hamburg = map.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude))
      .title("Hello Maps"));

}

Upvotes: 2

Related Questions