google maps - How to get nearby place in android when getting mylocation by lat and long -


i working on application mylocation latitude , longitude .now want users in 5 km within range .i using following code lat , long of user.

  if(gps.cangetlocation()){       getlatitude = gps.getlatitude();      getlongitude = gps.getlongitude();      latitude_mstring = string.valueof(getlatitude);      longitude_mstring = string.valueof(getlongitude);      log.d("value of lat , long",  latitude_mstring+""+longitude_mstring);      log.d("u r", "ur in register lati loni");         new thread(null,latlongthread,"").start();     }      }else{      gps.showsettingsalert(); }  marker = new markeroptions().position(new latlng(getlatitude, getlongitude)).title("me");  //marker.icon(bitmapdescriptorfactory.fromresource(r.drawable.));      cameraposition cameraposition = new cameraposition.builder().target(new latlng(getlatitude, getlongitude))             .zoom(12).build();         googlemap.animatecamera(cameraupdatefactory.newcameraposition(cameraposition));      googlemap.addmarker(marker);  return rootview; } 

by code can mylocation .i storing each user data in api .so have data regarding lat , long of each user .so want print user have location or lat , long within 5 km of me.

use location's distanceto method

http://developer.android.com/reference/android/location/location.html#distanceto(android.location.location)


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -