Error inflating class fragment: Duplicate id , tag null, or parent id with another fragment Error inflating class fragment: Duplicate id , tag null, or parent id with another fragment xml xml

Error inflating class fragment: Duplicate id , tag null, or parent id with another fragment


I solved it now!

The another solution is linked answer worked for me well.

https://stackoverflow.com/a/14484640/3960528

As explained there, I added onDestroyView() in `fragment that contains maps.

@Overridepublic void onDestroyView() {    super.onDestroyView();    MapFragment f = (MapFragment) getFragmentManager()                                         .findFragmentById(R.id.mymap);    if (f != null)         getFragmentManager().beginTransaction().remove(f).commit();}


This fixed my problem:

@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container,    Bundle savedInstanceState) {    if(rootView==null){        rootView = inflater.inflate(R.layout.MapFragment, container, false);    }    return rootView;}

More here:https://colinyeoh.wordpress.com/2014/07/20/android-mapfragment-exception-when-clicked-twice/


MapFragment f = (MapFragment) getFragmentManager()                                         .findFragmentById(R.id.mymap);    if (f != null)         getFragmentManager().beginTransaction().remove(f).commit();

Actually you don't need to use this inside an onDestroyView. My case was to remove an inflated layout with a SupportMapFragment, and that was it.