I'd love to hear opinions on the best way to communicate between fragments.
If we consider that fragments are like sub-activities (a common metaphor), then we might think to use broadcast messages to tell one fragment about something that happened in another fragment. That seems a bit difficult though not impossible. The samples simply lookup one fragment from another then access views directly. This forces that fragment to understand what's going on around it, which doesn't feel as object-oriented as I'd like. I'd feel better if maybe the activity was doing that sort of coordination, so the fragment tells the activity, and the activity figures out which other fragment, if any, needs to get a message, then invokes a method on the fragment so it can perform any updates. Or the activity could decide we're in a situation where we need to fire up a separate activity. Or maybe move things around on the screen. Am I over-complicating things here? I realize that a mobile app should be as compact as possible, and if that means "just do it" and access views in other fragments directly, then I could go along with that. But I thought I'd ask the group to get some other opinions. - dave -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en