I’m using fragments and when I select something on my left fragment, I want a right fragment to be created by my main activity.
So I did this to add my Fragment on a FrameLayout :
//add a fragment
FluxDetailFragment myFragment = new FluxDetailFragment();
fragmentTransaction.add(R.id.frameLayout3, myFragment);
fragmentTransaction.commit();
But I get this error :
02-02 15:34:03.104: E/AndroidRuntime(14794): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
Do I have to remove my FrameLayout view before? Or another view? How to do so?
To solve my problem, I had this :
Instead of that, I did this :
attachToRoot must be set to null to work.