-1

Android documentation doesn't seem to have much on it, other than stating that the fragment is removed once the Transaction is committed. Is the Fragment just gone? Like in a metaphysical sense? Or does it exist somewhere still, able to be called when needed? If so, how would you call it?

As a more pragmatic question, if you have an Activity that contains one fragment View and multiple Fragments that eventually go into that View, is there a way to reference Fragments other than the most recent one on the back stack (for question purposes, assuming they're all placed on there)

velocirabbit
  • 706
  • 7
  • 16
  • You will want to read more about the FragmentManager: http://developer.android.com/reference/android/app/FragmentManager.html – Martin Marconcini Oct 10 '15 at 03:11
  • To answer your question, the fragments are paused and stopped and _sometimes_ (if needed), destroyed. Easiest way to test (and understand) this behavior is to implement all fragment lifecycle (http://developer.android.com/guide/components/fragments.html#Lifecycle) and put logging. Then add/remove/hide fragments and see what happens. Fragment Manager reserves the right to retain those fragments for NN time, in anticipation of a possible return. – Martin Marconcini Oct 10 '15 at 03:13

1 Answers1

0

When you remove or detach fragment it doesn't removed from the project, it can be attch with another activity.

But once you pop fragment from the stack and destroy, it can't be revoked. Because when you destroy any fragments, a cleanup function is being called which cleans every part of that fragment.

KulArtist
  • 965
  • 8
  • 20