title: How to remove the marker in Google map v2?
body: <p>I added the marker on the map using following method and also kept the marker record</p>
  
  <pre><code>public static void  showallLocations() 
      {
          ArrayList&lt;LinkedHashMap&lt;String, String&gt;&gt; listshow=latLngStoragepreference.getLatlng();
          markerlist=new ArrayList&lt;Marker&gt;();// to keep the marker record so that later we can delete
          if(listshow.size()&gt;0)
          {
          for(int i=0;i&lt;listshow.size();i++)
          {
          LinkedHashMap&lt;String, String&gt; Linkedhashmap=listshow.get(i);
  
          Set mapSet = (Set) Linkedhashmap.entrySet();
          //Create iterator on Set 
          Iterator mapIterator = mapSet.iterator();
  
          Map.Entry mapEntry = (Map.Entry) mapIterator.next();
          // getKey Method of HashMap access a key of map
          String keyValue = (String) mapEntry.getKey();
          //getValue method returns corresponding key's value
          String value = (String) mapEntry.getValue();
          String[] parts=value.split("#");
          String Latitude=parts[0];
          String Longitude=parts[1];
          Double Latitudeconverted=Double.parseDouble(Latitude);
          Double Longitudeconverted=Double.parseDouble(Longitude);
          System.out.println(Latitudeconverted+""+Longitudeconverted);
          //show on map
          LatLng latLngs=new LatLng(Latitudeconverted, Longitudeconverted);
  
          Marker marker=map.addMarker(new MarkerOptions()
          .position(
                  latLngs)
                  .title(keyValue)
                  .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_navigate_to)));
          markerlist.add(marker);// keeping the record of marker object
  
          }
          }
  
  
      }
  </code></pre>
  
  <p>in custom baseadapter, I tried to remove the marker but <code>marker.remove()</code> is not working</p>
  
  <pre><code>holder.btnDeletelocation.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
  
  
          Marker marker=  MainActivity.markerlist.get(position);
          Log.d("MARKERlist before Remove", MainActivity.markerlist.toString());
  
          Log.d("MARKER Title",marker.getTitle());
  
  
          marker.remove();
          marker.setVisible(false);
          Log.d("MARKERlist after Remove", MainActivity.markerlist.toString());
  
  
  
              notifyDataSetChanged();
  
  
  
  
              }
          });
  </code></pre>
  
  <p>Please help If anybody had gone through the same. Thanks in advance</p>