Google Place Picker needs three clicks to open

68 Views Asked by At

I am revisiting an old Android app to upgrade it as much as possible, and I have found the following issue. There is a button on a fragment that should open Google Place Picker. The issue is that Google Place Picker is showing and inmediatelly closed the first two times when the button is clicked. The third time then it opens and stays opened.

This is the onclicklistener function:

  btnPlacePicker.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.d("pulsado loc","pulsado loc");
                PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
                try {
                    startActivityForResult(builder.build(getActivity()), PLACE_PICKER_REQUEST);
                } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
                    e.printStackTrace();
                }
            }
        });

I guess the issue may be due to some deprecation at Google Place Picker. What should I do to avoid the need to press 3 times the button?

1

There are 1 best solutions below

0
On

i had the same problem and i found a library that use the same methods of the deprecated Google Place Picker: https://github.com/rtchagas/pingplacepicker it works pretty the same! hope it works for you.