I am searching the place in my apps using the google autocomplete place api and now I want to get latitude and longitude of the place that i have searched. How to get latitude a
Places.GeoDataApi.getPlaceById(mGoogleApiClient, placeId)
.setResultCallback(new ResultCallback < PlaceBuffer > () {
@Override
public void onResult(PlaceBuffer places) {
if (places.getStatus().isSuccess() && places.getCount() > 0) {
final Place myPlace = places.get(0);
Log.i(TAG, "Place found: " + myPlace.getName());
LatLng latlangObj = myPlace.getLatLng();
Log.v("latitude:", "" + latlangObj.latitude);
Log.v("longitude:", "" + latlangObj.longitude);
} else {
Log.e(TAG, "Place not found");
}
places.release();
}
});
Use this method for getting lat and lang from placeid.