title: How to add markers on source and destination on load of a map using the google map api v2
body: <pre><code>      public void onLoad() {
  
  // Opening the sharedPreferences object
  preferences = getSharedPreferences("location", 0);
  
  // Getting number of locations already stored
  routeType = preferences.getInt("routeType", 0);
  
  // Getting stored zoom level if exists else return 0
  String zoom = preferences.getString("zoom", "0");
  
  // If locations are already saved
  if (routeType != 0) {
  
      String lat = "sourceAdd";
      String lng = "destinationAdd";
  
      // Iterating through all the locations stored
      for (int i = 0; i &lt; routeType; i++) {
  
          // Getting the latitude of the i-th location
          lat = preferences.getString("lat" + i, "0");
  
          // Getting the longitude of the i-th location
          lng = preferences.getString("lng" + i, "0");
  
          // Drawing marker on the map
          drawMarker(new LatLng(Double.parseDouble(lat),
                  Double.parseDouble(lng)));
      }
      // Moving CameraPosition to last clicked position
      map.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(Double
              .parseDouble(lat), Double.parseDouble(lng))));
  
      // Setting the zoom level in the map on last position is clicked
      map.animateCamera(CameraUpdateFactory.zoomTo(Float.parseFloat(zoom)));
  }
  </code></pre>
  
  <p>}</p>
  
  <p>public void drawMarker(LatLng point) {</p>
  
  <pre><code>    // Creating an instance of MarkerOptions
      MarkerOptions markerOptions = new MarkerOptions();
  
      // Setting latitude and longitude for the marker
      markerOptions.position(point);
  
      // Adding marker on the Google Map
  
      map.addMarker(new MarkerOptions()
              // map.addMarker(markerOptions);
              .title("Marker")
              .snippet("Marker Yo Yo")
              .icon(BitmapDescriptorFactory
                      .defaultMarker(BitmapDescriptorFactory.HUE_AZURE))
              .position(point)
  
      );
  
  }
  </code></pre>
  
  <p>Hi,</p>
  
  <p>I need to add 2 markers on the map such as the source and the destination, i used the above code and when i run the application i am getting a black line displaying the route between source and destination but the markers are not appearing on the map:( can someone help me?</p>