IllegalStateException: The specified child already has a parent. You must call removeView() on the child’s parent first

Another error when working with fragments.

06-01 10:20:40.030: E/AndroidRuntime(8706): FATAL EXCEPTION: main
06-01 10:20:40.030: E/AndroidRuntime(8706): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child’s parent first.
06-01 10:20:40.030: E/AndroidRuntime(8706): at android.view.ViewGroup.addViewInner(ViewGroup.java:3378)

Solution was to replace:
return inflater.inflate(R.layout.simple_tabs, container, true);
with:
return inflater.inflate(R.layout.simple_tabs, null);

Leave a Reply

Your email address will not be published. Required fields are marked *

Please reload

Please Wait