I would like to reuse same fragment instance(Music player control panel) in more activities. I created singleton fragment instance. I successfully add it in first activity but when I trie to add it in second activity I get exception: Fragment already active. I tried getSupportFragmentManager().beginTransaction().remove before add or getSupportFragmentManager().beginTransaction().replace but as it’s not executed immediately I always get exception.
Some ideas how to have same fragment instance in more activities?
Thanks
You cannot use the same fragment object more than once. Not sure why you try to do that, but if you want these objects to stay “in sync”, simply share its state among objects/activities instead