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
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == Constant.REQUEST_LOCATION_CODE) {
Place place = PlaceAutocomplete.getPlace(this, data);
if (place != null) {
LatLng latLng = place.getLatLng();
mStringLatitude = String.valueOf(latLng.latitude);
mStringLongitude = String.valueOf(latLng.longitude);
EditTextAddress.setText(place.getAddress());
}
}
}
With the code above, you can get the LatLng as well as the String address. Use the LatLng wherever you want.