I've recently put together an app that makes heavy use fragments in the master->details view scenario where you'd select the first list item in the fragment and then details fragment would update accordingly. But Iv'e got another need to actually swap out fragments (for the appearance of how say a tab view would look (clicking on diff things, would produce diff fragments all together, not just the same fragment with slightly different values.
What Iv'e tried so far... Check for fragment thats already created with tag... if one exists, replace a dummy framelayout with that, otherwise, create it and replace. On very simple fragments that literally had no id's anywhere etc.. .the fragments worked perfectly as expected... however on slightly more complex fragments, it always seems to complain about the existence of the id's or that the fragment has already been added (after the fragment was shown the first time). Also played with different combinations of removing the fragment if it existed... non of which seemed to be an end all solution. Tried making the parent layout a linearview and just hide/show (which may infact better emulate the effect I was going for anyway), but because its still calling inflate(), it still has duplicate id problems. So this leads me to a couple questions.... 1) Does a fragment manage knowing anything about an existing fragment have anything to do with being able to see the fragment? It would seem that regardless of adding/removing/hiding/showing, the fragment was always still there. 2) when I add or replace, should I be creating a new instance of that fragment, or could I theoretically have instances... (and does the add process just "register" it with the fragment manager? 3) Am I going about this completely wrong? I still like that the separation is there, and that the fragments are decoupled and reusable, but doesnt seem like the reuse is actually there.. I cant replace an instance of a fragment with another instance if the other instance. I have done some research and saw the references to the problem with inflating views into parent context or root, and likewise always do my inflation with R.layout.whatever,null,false. Thanks for any help! Weston -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

