title: How to get nearest marker with google maps api on android studio
body: <p>I am trying to create an app for a company that has a page that shows the nearest shop (since there are 36 shops in the country) I am using the Google Maps API and I don't know what to do this is my java class code:</p>
  
  <pre><code>private GoogleMap mMap;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_contact_page);
      SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
              .findFragmentById(R.id.map);
      mapFragment.getMapAsync(this);
  }
  
  @Override
  public void onMapReady(GoogleMap googleMap) {
      mMap = googleMap;
      LatLng Alexandra = new LatLng(-45.249167, 169.379722);
      mMap.addMarker(new MarkerOptions().position(Alexandra).title("Bin Inn Alexandra"));
      mMap.moveCamera(CameraUpdateFactory.newLatLng(Alexandra));
  }}
  </code></pre>
  
  <p>and this is my xml code ignore the button that is where im going to put the shops info:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  android:gravity="center"&gt;
  
  &lt;fragment
      android:id="@+id/map"
      android:name="com.google.android.gms.maps.SupportMapFragment"
      android:layout_width="match_parent"
      android:layout_height="0dp"
      android:layout_weight="1"
      tools:context=".MapsActivity" /&gt;
  
  &lt;Button
      android:id="@+id/button"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Button" /&gt;
  </code></pre>
  
  <p></p>