FragmentDialog is a cleaner and better solution. If you are using fragments, use FragmentDialog.
On Fri, Apr 29, 2011 at 5:45 PM, goosedroid <[email protected]> wrote: > > > On Apr 29, 1:57 pm, Mark Murphy <[email protected]> wrote: > > On Fri, Apr 29, 2011 at 4:52 PM, goosedroid <[email protected]> > wrote: > > > Sorry for confusion. My Fragment which needs to show the AlertDialog > > > also has the actions for that Dialog - so it seems basic that it > > > should just create & show the dialog itself. If I were to break this > > > into two Fragments, the first needing to show the Dialog, and the > > > second which actually shows the Dialog, how do I communicate the > > > result back to the first Fragment? > > > > > The example for DialogFragment has the DialogFragment communicating > > > back to its containing Activity, which is not what I need. > > > > Have the activity pass the information along to the other fragment. > > Can you provide an example of how this scenario would work? > > > > > With managed dialogs being semi-deprecated, I really recommend getting > > DialogFragment to do the work. Off the cuff, it feels like you need to > > move more of the business logic ("the actions for that Dialog") into > > the DialogFragment. > > I have a good reason why all the business logic is in the first > Fragment, and why it should not be spread among 3 DialogFragments > (since there are 3 dialogs). > > The Fragment needing to show the Dialog is a "Worker" Fragment without > a UI. It is used by several Activities. It contains a complex state > machine which receives many asynchronous inputs. > > The actions of each of the 3 AlertDialogs are also inputs to this > state machine. The machine should remain encapsulated in the Worker > Fragment, Activities using the Worker Fragment should not need to know > about it. > > > > > > Looking through the docs, it seems Fragment.setTargetFragment may be > > > involved here, but there is not much good information on how this > > > works. > > > > Yeah, I haven't tried that. > > > > -- > > Mark Murphy (a Commons Guy)http://commonsware.com| > http://github.com/commonsguyhttp://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

