Fragments - the Specified Child Already Has a Parent. You Must Call Removeview() on the Child's Parent First

Fragments - The specified child already has a parent. You must call removeView() on the child's parent first

Try to replace

View v = inflater.inflate(R.layout.camera_fragment, parent);

With

View v = inflater.inflate(R.layout.camera_fragment, parent, false);

or

View v = inflater.inflate(R.layout.camera_fragment, null);

Android fragments - The specified child already has a parent. You must call removeView() on the child's parent first

I'll take a shot and suggest you get the error because you return mDrawerListView in onCreateView() instead of group. The returned from onCreateView() view is itself attached to another view hierarchy, which is impossible in this case because from the XML layout it already has a parent ViewGroup.

I can see nothing preventing from returning group in onCreateView().

Android Fragment API 26 The specified child already has a parent. You must call removeView() on the child's parent first.

So it appears it has something to do with

transaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left);



Related Topics



Leave a reply



Submit