title: I'm trying to search nearby places such as banks, restaurants, ATMs inside the drawn area on google maps in android
body: <p>I'm trying to search nearby places such as banks, restaurants, ATMs inside the drawn area on google maps in android. I get coordinates (Latitude and Longitude) in an array, but I'm unable to find nearby places by that array. 
  Can somebody help me? I tried to search but found no results.
  <strong>Great help will be appreciated!</strong></p>
  
  <p>This is my drawn area code:</p>
  
  <pre><code>public class MainActivity extends FragmentActivity implements OnTouchListener {
  
      private static final String TAG = "polygon";
      private GoogleMap mGoogleMap;
      private View mMapShelterView;
      private GestureDetector mGestureDetector;
      private ArrayList&lt;LatLng&gt; mLatlngs = new ArrayList&lt;LatLng&gt;();
      private PolylineOptions mPolylineOptions;
      private PolygonOptions mPolygonOptions;
      // flag to differentiate whether user is touching to draw or not
      private boolean mDrawFinished = false;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          mMapShelterView = (View) findViewById(R.id.drawer_view);
          mGestureDetector = new GestureDetector(this, new GestureListener());
          mMapShelterView.setOnTouchListener(this);
          initilizeMap();
          //Contains(null);
      }
  
      private final class GestureListener extends SimpleOnGestureListener {
          @Override
          public boolean onDown(MotionEvent e) {
              return true;
          }
  
          @Override
          public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
                  float velocityY) {
              return false;
          }
      }
  
      /**
       * Ontouch event will draw poly line along the touch points
       * 
       */
      @Override
      public boolean onTouch(View v, MotionEvent event) {
          int X1 = (int) event.getX();
          int Y1 = (int) event.getY();
          Point point = new Point();
          point.x = X1;
          point.y = Y1;
          LatLng firstGeoPoint = mGoogleMap.getProjection().fromScreenLocation(
                  point);
          switch (event.getAction()) {
  
          case MotionEvent.ACTION_DOWN:
              break;
  
          case MotionEvent.ACTION_MOVE:
              if (mDrawFinished) {
                  X1 = (int) event.getX();
                  Y1 = (int) event.getY();
                  point = new Point();
                  point.x = X1;
                  point.y = Y1;
                  LatLng geoPoint = mGoogleMap.getProjection()
                          .fromScreenLocation(point);
                  mLatlngs.add(geoPoint);
                  mPolylineOptions = new PolylineOptions();
                  mPolylineOptions.color(Color.RED);
                  mPolylineOptions.width(3);
                  mPolylineOptions.addAll(mLatlngs);
                  mGoogleMap.addPolyline(mPolylineOptions);
                  **Log.d(TAG, "Latitude and longitude: " + mLatlngs);**
  
              }
              break;
          case MotionEvent.ACTION_UP:
              Log.d(TAG, "Poinnts array size " + mLatlngs.size());
              mLatlngs.add(firstGeoPoint);
              mGoogleMap.clear();
              mPolylineOptions = null;
              mMapShelterView.setVisibility(View.GONE);
              mGoogleMap.getUiSettings().setZoomGesturesEnabled(true);
              mGoogleMap.getUiSettings().setAllGesturesEnabled(true);
              mPolygonOptions = new PolygonOptions();
              mPolygonOptions.fillColor(0x5500ff00);
             // mPolygonOptions.fillColor(Color.LTGRAY);
              mPolygonOptions.strokeColor(Color.RED);
              mPolygonOptions.strokeWidth(5);
              mPolygonOptions.addAll(mLatlngs);
              mGoogleMap.addPolygon(mPolygonOptions);
              mDrawFinished = false;
              break;
          }
          return mGestureDetector.onTouchEvent(event);
      }
  
      /**
       * Setting up map
       * 
       */
  
      private void initilizeMap() {
          int status = GooglePlayServicesUtil
                  .isGooglePlayServicesAvailable(getApplicationContext());
          if (status == ConnectionResult.SUCCESS) {
              if (mGoogleMap == null) {
                  mGoogleMap = ((SupportMapFragment) getSupportFragmentManager()
                          .findFragmentById(R.id.map)).getMap();
                  mGoogleMap.setMyLocationEnabled(true);
  
              }
  
          } else if (GooglePlayServicesUtil.isUserRecoverableError(status)) {
              // showErrorDialog(status);
          } else {
              Toast.makeText(this, "No Support for Google Play Service",
                      Toast.LENGTH_LONG).show();
          }
      }
  
      /**
       * Method gets called on tap of draw button, It prepares the screen to draw
       * the polygon
       * 
       * @param view
       */
  
      public void drawZone(View view) {
          mGoogleMap.clear();
          mLatlngs.clear();
          mPolylineOptions = null;
          mPolygonOptions = null;
          mDrawFinished = true;
          mMapShelterView.setVisibility(View.VISIBLE);
          mGoogleMap.getUiSettings().setScrollGesturesEnabled(false);
      }
  
      public synchronized boolean Contains(Location location) {
          boolean isInside = false;
  
          if (mLatlngs.size() &gt; 0) {
              LatLng lastPoint = mLatlngs.get(mLatlngs.size() - 1);
  
              double x = location.getLongitude();
  
              for (LatLng point : mLatlngs) {
                  double x1 = lastPoint.longitude;
                  double x2 = point.longitude;
                  double dx = x2 - x1;
  
                  if (Math.abs(dx) &gt; 180.0) {
                      if (x &gt; 0) {
                          while (x1 &lt; 0)
                              x1 += 360;
                          while (x2 &lt; 0)
                              x2 += 360;
                      } else {
                          while (x1 &gt; 0)
                              x1 -= 360;
                          while (x2 &gt; 0)
                              x2 -= 360;
                      }
                      dx = x2 - x1;
                  }
  
                  if ((x1 &lt;= x &amp;&amp; x2 &gt; x) || (x1 &gt;= x &amp;&amp; x2 &lt; x)) {
                      double grad = (point.latitude - lastPoint.latitude) / dx;
                      double intersectAtLat = lastPoint.latitude
                              + ((x - x1) * grad);
  
                      if (intersectAtLat &gt; location.getLatitude())
                          isInside = !isInside;
                  }
                  lastPoint = point;
              }
          }
  
          return isInside;
      }
  </code></pre>
  
  <p>I got array on mLatlang ,now I want near by places according to that coordinates not by my current location</p>