code to add markers to map using android google maps v2

I'm guessing the issue is that you are multiplying your latitude/longitude values by 1E6 instead of dividing them by 1E6. If your stored values came from GeoPoints, that might be your issue. Otherwise, the way you are adding the Markers is fine and should work.

i.e. the lat/lng values you pass to new LatLng() should look like 45.4,-95.5 NOT 45400000,-95500000

Check out the following code:

//mMap is a GoogleMap and point is a GeoPoint
this.mMap.addMarker(getMarker(point, drawableId))

...

public MarkerOptions getMarker(GeoPoint point, int drawableId)
{
    return new MarkerOptions()
    .position(new LatLng(point.getLatitudeE6() / 1000000.0, point.getLongitudeE6() / 1000000.0))
    .icon(BitmapDescriptorFactory.fromResource(drawableId));
}

Use the Marker Class

An icon placed at a particular point on the map's surface. A marker icon is drawn oriented against the device's screen rather than the map's surface; i.e., it will not necessarily change orientation due to map rotations, tilting, or zooming.

A marker has the following properties:

Anchor

The point on the image that will be placed at the LatLng position of the marker. This defaults to 50% from the left of the image and at the bottom of the image.

Position

The LatLng value for the marker's position on the map. You can change this value at any time if you want to move the marker.

Title

A text string that's displayed in an info window when the user taps the marker. You can change this value at any time.

Snippet

Additional text that's displayed below the title. You can change this value at any time.

Icon

A bitmap that's displayed for the marker. If the icon is left unset, a default icon is displayed. You can specify an alternative coloring of the default icon using defaultMarker(float). You can't change the icon once you've created the marker.

Drag Status

If you want to allow the user to drag the marker, set this property to true. You can change this value at any time. The default is true.

Visibility

By default, the marker is visible. To make the marker invisible, set this property to false. You can change this value at any time.

GoogleMap map = ... // get a map.
   // Add a marker at San Francisco.
   Marker marker = map.addMarker(new MarkerOptions()
       .position(new LatLng(37.7750, 122.4183))
       .title("San Francisco")
       .snippet("Population: 776733"));

You have to use the method GoogleMap.addMarker(MarkerOptions); I've explained this in a tutorial on my blog: http://bon-app-etit.blogspot.be/2012/12/add-informationobject-to-marker-in.html

On this blog, you'll find some more posts concerning the new Maps API:

  • Move the map to current or some location
  • Create the custom InfoWindow
  • Associate geodata or objects to a marker