i keep getting following errors, it's basically same error but keeps occuring on different lines
Fatal Exception: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. at android.view.ViewGroup.addViewInner(ViewGroup.java:3883)
Fatal Exception: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. at android.view.ViewGroup.addViewInner(ViewGroup.java:4312)
Fatal Exception: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. at android.view.ViewGroup.addViewInner(ViewGroup.java:4310)
Things i have tried :-
while adding any fragment i add this code in onCreateView
((ViewGroup) view.getParent()).removeView(view); view = inflater.inflate(R.layout.create_carpool_layout, container, false); return view;
and then inflate the view
While inflating layouts / views in adapter also i make sure the view is removed from parent view
I am not sure what is causing this problem