title: Find Marker by Tag Google Maps API (Android)
body: <p>How/Where could I get a reference of all marker objects current on the map, in order to check something like this:</p>
  
  <pre><code>if (Markers.getTag().equals("something"))
  </code></pre>
  
  <p>By reading the documentation on Marker it said "This is easier than storing a separate Map", so I don't want to use HashMap unless someone say I absolutely have to.</p>
  
  <p>Thanks, the following is a pseudo-pseudo code</p>
  
  <p>// The uid is the Marker's tag</p>
  
  <p>// 1) <strong>Someway to Check if the tag exists for the current profile</strong></p>
  
  <p>// 2) <strong>If it exists, then just move the marker, just set a new position of this marker.</strong></p>
  
  <p>// 3) If it doesn't, then create a new marker, add a marker.</p>
  
  <p>// 4) Set profile uid as the Marker's Tag, via .setTag()</p>
  
  <p>// 5) Animate move camera to the latlng position</p>
  
  <p>3-5 is okay, just 1-2</p>
  
  <pre><code>// 3) Create a new marker
                              // Marker to show on the map
                              Marker friendMarker;
  
                              // Add a marker when the image is loaded
                              friendMarker = googleMap.addMarker(new MarkerOptions()
                                              .position(friendLatLng)
                                              .icon(BitmapDescriptorFactory.fromBitmap(bitmap))
                                              .title(friendProfile.getName()));
  
                              // Set the tag on this friend marker, so we can retrieve or update it later
                              friendMarker.setTag(friendProfile.getUid());
  
                              // 5) Animate the camera to that location
                              CameraPosition cameraPosition = new CameraPosition.Builder().target(friendLatLng).zoom(15).build();
                              googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
  </code></pre>