Quick question about fragments (warning: I am a complete beginner). is it possible to perform mult...
f
Quick question about fragments (warning: I am a complete beginner). is it possible to perform multiple actions on a single fragment? For example, l've created fragments 1, 2, 3 and 4. Fragment 1 has one button which let's me navigate to fragment 2. Fragment 2 has two buttons, one is meant to allow me to return to Fragment 1 while the other is meant to take me to the next fragment (Fragment 3)...and Fragment 3 and 4 is similar to Fragment 2. I was able to move from Fragment 1 to 2. In Fragment 2, only one of the buttons worked correctly. The button that worked only allowed me to return to Fragment 1, however, every time I click on the button that's meant to take me to Fragment 3, my app crashes. My question is, are fragments only meant to allow one function per frame?......can one fragment not hold many functions e.g. having multiple buttons on one Fragment that does different things? All the videos I've seen online so far are only showing examples of - "One fragment, one function, one direction". Any feedback will be appreciated.
😶 4
v
The FragmentManager has its backstack. So you only can move forward and backward in this backstack. If you want to remove the current fragment (in your example, get back to the previous one) and move to the next one, it's easily achievable with the current API.