Ad

Close Activity On Closing PlacePicker

- 1 answer

As I understand, PlacePicker is a widget that comes on top of an Activity or Fragment.

I want to handle the back button to close the activity as well as the PlacePicker when I click on it.

PlacePicker with Default Android Navigation at the bottom

Right now, when I press the back button the PlacePicker closes first and the activity closes only after I press the back button again.

@Override
public void onBackPressed() {
    super.onBackPressed();
    finish();
}

The above code is only executed after the PlacePicker is closed on click of the back button the first time.

Ad

Answer

Though I could not find a direct solution, I was able to solve this with initiating the PlacePicker at the calling activity only.

To show the details returned by the PlacePicker, I used another activity with the help of an Intent.

Ad
source: stackoverflow.com
Ad