title: How to get near by places with in radius of 5 kilometer from current location?
body: <p>What i have done so far is that i m successfully  getting the near by places like Atm Banks Restaurant from the whole twin cities 
  But i just want to show the nearby places that is with in 5 kilometer to the current user location i have searched a lot but could not find any answer to my question </p>
  
  <p>"This is my code where i m getting the places by names "</p>
  
  <pre><code>myLocation = new MyLocation(context);
  
      if (myLocation.isLocationAvailable() &amp;&amp; myLocation.getUserLocation() != null)
      {
          current_location_lat =  myLocation.getUserLocation().latitude;
  
          current_location_lng =  myLocation.getUserLocation().longitude;
  
          latStr = current_location_lat + "";
  
          longStr = current_location_lng + "";
  
          myLatLng = new LatLng(current_location_lat, current_location_lng);
  
          //url = url_part1 + latStr + "," + longStr + url_part2;
  
          Log.d("LATITUDE", String.valueOf(current_location_lat));
  
          Log.d("LONGITUDE", String.valueOf(current_location_lng));
  
  
          new PlaceTask(context, positionOfType, latStr, longStr, new onTaskDoneListener() 
          {
              @Override
              public void onTaskDone(JSONObject jsonObject) 
              {
                  if(jsonObject!=null)
                  {
                      try 
                      {
                          JSONObject obj = jsonObject;//new JSONObject(jsonObject);
  
                          String status = obj.getString("status");
  
                          if(status.equals("OK"))
                          {
                              JSONArray arr = obj.getJSONArray("results");
  
                              for(int i = 0; i &lt; arr.length(); i++)
                              {
                                  double lat = arr.getJSONObject(i).getJSONObject("geometry").getJSONObject("location").getDouble("lat");
  
                                  double lng = arr.getJSONObject(i).getJSONObject("geometry").getJSONObject("location").getDouble("lng"); 
  
                                  String place_name = arr.getJSONObject(i).getString("name");
  
                                  String vicinity = arr.getJSONObject(i).getString("vicinity");
  
  
                                  HashMap&lt;String, String&gt; map = new HashMap&lt;String,String&gt;();
  
                                  map.put("placeName", place_name);
  
                                  map.put("vicinity", vicinity);
  
                                  map.put("lat", String.valueOf(lat));
  
                                  map.put("lng", String.valueOf(lng));
  
                                  list.add(map);
                                  Global_Var.latvalue.add(i,String.valueOf(lat));
                                  Global_Var.longtvalue.add(i,String.valueOf(lng));
                              }
  
                              NearByPlaceAdapter adapter = new NearByPlaceAdapter(context, list);
  
                              listView.setAdapter(adapter);
                          }
                      } 
                      catch (JSONException e) 
                      {
                          e.printStackTrace();
                      }
                  }
                  else
                  {
                      Toast.makeText(context, "Response is Null", Toast.LENGTH_LONG).show();
                  }
  
              }
          }).execute();
  
          //showSearchDialog(map);    
      }               
      else
      {
          Toast.makeText(context, "Please Enable Location Services and GPS From your Device", 
                  Toast.LENGTH_LONG).show();
      }       
  </code></pre>
  
  <p>MyLocation </p>
  
  <pre><code>public MyLocation(Context context) {
      this.context = context;
  
      try {
          manager = (LocationManager) context
                  .getSystemService(Context.LOCATION_SERVICE);
          if (manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
              islocavailable = true;
              manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000,
                      1, this);
              Log.d("gps enabled", "gps enabled");
              String locationProvider = LocationManager.GPS_PROVIDER;
  
              Location lastKnownLocation = manager
                      .getLastKnownLocation(locationProvider);
              userLocation = new LatLng(lastKnownLocation.getLatitude(),
                      lastKnownLocation.getLongitude());
              Log.d("gps disabled 1", lastKnownLocation.getLatitude() + ","
                      + lastKnownLocation.getLongitude());
              // map.moveCamera(CameraUpdateFactory.newLatLngZoom(userLocation,
              // 15));
              // islocavailable=true;
          } else if (manager
                  .isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
              islocavailable = true;
              manager.requestLocationUpdates(
                      LocationManager.NETWORK_PROVIDER, 1000, 1, this);
              String locationProvider = LocationManager.NETWORK_PROVIDER;
  
              Location lastKnownLocation = manager
                      .getLastKnownLocation(locationProvider);
              userLocation = new LatLng(lastKnownLocation.getLatitude(),
                      lastKnownLocation.getLongitude());
              // map.moveCamera(CameraUpdateFactory.newLatLngZoom(userLocation,
              // 15));
              Log.d("gps disabled 2", lastKnownLocation.getLatitude() + ","
                      + lastKnownLocation.getLongitude());
              // islocavailable=true;
          } else {
              Log.d("all disabled", "all disabled");
  
              islocavailable = false;
              // showAlertDialog();
          }
      } catch (NullPointerException ex) {
                  ex.printStackTrace();
      }
  
  }
  </code></pre>