 <p>I had this code in a fragment and it was crashing if I try to come back to this fragment</p> <pre><code>if (mRootView == null) { mRootView = inflater.inflate(R.layout.fragment_main, container, false); } </code></pre> <p>after gathering the answers on this thread, I realised that mRootView's parent still have mRootView as child. So, this was my fix.</p> <pre><code>if (mRootView == null) { mRootView = inflater.inflate(R.layout.fragment_main, container, false); } else { ((ViewGroup) mRootView.getParent()).removeView(mRootView); } </code></pre> <p>hope this helps</p>