I'm trying to use Google's Place Autocomplete (https://developers.google.com/places/android-api/autocomplete) to implement into a fragment in my app. But I got this error when navigating from this fragment to other fragment and then coming back into this fragment
Caused by: java.lang.IllegalArgumentException: Binary XML file line #30: Duplicate id 0x7f0f010f, tag null, or parent id 0x7f0f00c0 with another fragment for com.google.android.gms.location.places.ui.PlaceAutocompleteFragment at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2148) This is the java code
private PlaceAutocompleteFragment mSearchPAF; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.some_layout, container, false); mSearchLocationPAF = (PlaceAutocompleteFragment) parentActivity.getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment); } This is the XML file
<RelativeLayout android:id="@+id/someRelativeLayout" android:layout_width="wrap_content" android:layout_height="36dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="30dp" android:background="@drawable/some_drawable"> <fragment android:id="@+id/place_autocomplete_fragment" android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment" android:layout_width="match_parent" android:layout_height="wrap_content" /> </RelativeLayout> I also have another map fragment in this same java and xml file but I managed to solve it by following the answers in this post (Duplicate ID, tag null, or parent id with another fragment for com.google.android.gms.maps.MapFragment) but I can't find any solution for this Place Autocomplete fragment
PlaceAutoCompleteof your own.PlaceAutoCompletefragment.