My application has and activity with a viewPager and 4 fragments.
In one fragment I added a google SupportPlaceAutocompleteFragment
and
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.area_swipe_fragment, container, false);
SupportPlaceAutocompleteFragment autocompleteFragment = (SupportPlaceAutocompleteFragment)
getChildFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(Place place) {
Toast.makeText(ctx, "do something", Toast.LENGTH_SHORT).show();
}
@Override
public void onError(Status status) {
}
});
return view;
}
My problem is the onPlaceSelectedListener
is never fired and I can't get the result of the selected place. Instead get fired the onActivityResults()
placed in the second fragment.
I tried with a onActivityResults()
in the first fragment but it doesn't get fired, always executed the one in the second fragment.
Any ideas?