Fragments are handy even outside of UI design. I was writing a game and had background music running through the menus and other bg music for in-game. I also wanted the background music to be paused when the user left the app (for obvious reasons). By using fragments, I could use the Activity for all the application lifecycle management (making sure the music paused in onStop, etc) without having to make checks for if we were going to another Activity in the app or hand off the SoundEngine to the newly started Activity. I'd tried using a ViewFlipper to do this before and it was clear that it was not designed for that. Fragments did it exactly the way I wanted them to. Oh, and the ads became their own Fragment too, so they had a separate lifecycle from each of the screens.
-- You received this message because you are subscribed to the Google Groups "Android Discuss" 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-discuss?hl=en.
