Reputation: 439
I am using Google's PlaceAutoCompleteFragment in a recent project that I am currently working on. When I click on the PlaceAutoCompleteFragment very quickly it open multiple overlays on my app which is really annoying. how can I prevent it from opening multiple overlays? My code for the fragment is given below:
if (autocompleteFragment == null) {
autocompleteFragment = (PlaceAutocompleteFragment)getFragmentManager().findFragmentById(R.id.place_autocompletehome_fragment);
}
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(Place place) {
// TODO: Get info about the selected place.
try {
Log.i("esty", "Place: " + place.getName());
} catch (Exception e) {
Log.e("esty", "Error: " + e.getMessage());
}
}
@Override
public void onError(Status status) {
// TODO: Handle the error.
Log.e("esty", "An error occurred: " + status);
}
});
Upvotes: 7
Views: 1139
Reputation: 3026
Why don't you try a hack to solve this problem. Put a on click listener on the whole fragment and use multi click blocker to pass the click event once.
Refer to the below solution : https://stackoverflow.com/a/23103227/4901098
Upvotes: 1
Reputation: 10889
It looks like this is a bug in PlaceAutocompleteFragment (and SupportPlaceAutocompleteFragment). Thank you for bringing it to our attention. We'll look at fixing this in an upcoming release.
Upvotes: 5