Also, there's 2 factors: 1- my DateTimePickerDialogFragment is being included in a different library project, so it will not know the sub type of Fragment being passed. 2- in one target fragment i will need, i have two edittexts in the same fragment so the DateTimePickerDialogFragment must somehow point to the correct edittext....
regards, On Wednesday, June 6, 2012 2:16:42 PM UTC+1, Bluemercury wrote: > > > Hi al! i've read the answer from Dianne, and it seems i can declare an > interface in one fragment and then implement it on another. But for this i > need the pointer to the fragment in question, she said: > > " take advantage of the FragmentManager APIs to save a fragment "pointer" > in a bundle and later retrieve it, to allow you to maintain direct pointers > across state save/restore. " > > What's the best way to do this? Here's my code to call the dialogfragment > in the main frag: > > "dialFragment=DateTimePickerDialogFragment.newInstance(DateTimePickerDialogFragment.DATETIME_PICKER, > > dateBeginTV); > dialFragment.show(fragMan, "dialog");" > > how can i send the pointer to the dialogfragment, and will it survive the > rotation? > > > On Wednesday, June 6, 2012 8:20:30 AM UTC+1, al wrote: >> >> Ok, I assumed that text field was part of the activity. In your case >> https://groups.google.com/forum/?fromgroups#!topic/android-developers/NBlMJnMaGboshould >> help, especially the answer of Dianne. >> >> In short: you might just do >> "dialogfragment.setTargetFragment(textfieldfragment)" in the activity to >> link the fragments. Android will then take care of that reference. In the >> dialogFragment you can then pass the new value like >> "((MyFragmentClass)getTargetFragment()).setDateTimeField(curDateTime()). >> >> > -- 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