Place Picker Usage Example

suggest change

Place Picker is a really simple UI widget provided by Places API. It provides a built-in map, current location, nearby places, search abilities and autocomplete.

This is a sample usage of Place Picker UI widget.

private static int PLACE_PICKER_REQUEST = 1;

private TextView txtPlaceName;

protected void onCreate(Bundle savedInstanceState) {

    txtPlaceName = (TextView) this.findViewById(;
    Button btnSelectPlace = (Button) this.findViewById(;
    btnSelectPlace.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {


private void openPlacePickerView(){
    PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
    try {
        startActivityForResult(, PLACE_PICKER_REQUEST);
    } catch (GooglePlayServicesRepairableException e) {
    } catch (GooglePlayServicesNotAvailableException e) {

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == PLACE_PICKER_REQUEST) {
        if (resultCode == RESULT_OK) {
            Place place = PlacePicker.getPlace(this, data);
            Log.i(LOG_TAG, String.format("Place Name : %s", place.getName()));
            Log.i(LOG_TAG, String.format("Place Address : %s", place.getAddress()));
            Log.i(LOG_TAG, String.format("Place Id : %s", place.getId()));

            txtPlaceName.setText(String.format("Place : %s - %s" , place.getName() , place.getAddress()));

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents