There is an easy way to do this -- call setTargetFragment() on the DialogFragment to tell it who to tell about its result:
http://developer.android.com/reference/android/app/Fragment.html#setTargetFragment(android.app.Fragment, int) An ApiDemo using this API is here: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/FragmentRetainInstance.html On Fri, Apr 29, 2011 at 6:02 PM, Mark Murphy <[email protected]>wrote: > On Fri, Apr 29, 2011 at 5:45 PM, goosedroid <[email protected]> wrote: > > Can you provide an example of how this scenario would work? > > Not specifically with a DialogFragment, but passing events between > fragments by way the activity is really the only way to do it for > *any* fragments. One fragment should neither know nor care whether > another fragment is in the foreground activity or not. > > So, you have: > > https://github.com/commonsguy/cw-android/tree/master/Fragments/EU4You_6 > > where tapping on the name of a country triggers a listener interface > on the activity, which turns around and passes the information to a > second fragment to display the mobile Wikipedia page. > > Or, you have: > > > https://github.com/commonsguy/cw-advandroid/tree/master/Honeycomb/FeedFragments > > with three fragments (two ListFragments and a regular Fragment), where > list clicks ripple up to the activity, who forwards the event to the > right fragment (or activity, for smaller screens). > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://github.com/commonsguy > http://commonsware.com/blog | http://twitter.com/commonsguy > > Android Training...At Your Office: http://commonsware.com/training > > -- > 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 > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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

