Android_Me icon indicating copy to clipboard operation
Android_Me copied to clipboard

Can't change container ID of fragment BodyPartFragment

Open VladVh opened this issue 8 years ago • 3 comments

When trying to launch the solution for the exercise DisplayThreeFragments app crashes with the error: Caused by: java.lang.IllegalStateException: Can't change container ID of fragment BodyPartFragment{302569e id=0x7f0b0058}: was 2131427416 now 2131427417 on the emulator Nexus 5 API 24

However, if I add fragmentManager.executePendingTransactions() after each transaction - it works.

VladVh avatar Jun 29 '17 12:06 VladVh

same

bonetoy avatar Dec 14 '17 06:12 bonetoy

You probably created only one instance of BodyPartFragment and then trying to update its fields value which causes the error.Create a new fragment object for each transaction.

vishalenrique avatar Mar 01 '18 18:03 vishalenrique

Why can't we use same fragment object and place it in three separate Framelayout? I would like to know why this happens.

deepakgithub1989 avatar Jun 24 '18 05:06 deepakgithub1989