Prateek Paliwal Prateek Paliwal - 1 month ago 9
Android Question

Showing particular area in google PlacePicker

I am working on an android application which requires user to select his/her location. I am using Google's PlacePikcer API to do so. It is working fine, but I want to show a particular area when I click on PlacePicker button. For example when I start the placepicker intent, it should show the map of a particular area or radius to make the search more specific.
I searched a lot but couldn't find a way. Please help.

Answer

You can try the following approach.

LatLng bottomLeft = new LatLng(**bottom left latitude** , **bottom left longitude**);
LatLng topRight = new LatLng(**top right latitude** , **top right longitude**);

LatLngBounds bounds = new LatLngBounds(bottomLeft ,topRight);


PlacePicker.IntentBuilder intentBuilder = new PlacePicker.IntentBuilder();
intentBuilder.setLatLngBounds(bound);

// now use intentBuilder to build intent.

bottom left latitude and bottom left longitude mark the bottom left corner of the area you want to show and top right latitude and top right longitude mark the top right corner of the area.