Hi al! The thing is here im using framents, the text field is on the fragment, not on the activity itself. The ideia was to create a dynamic dialofgragment without to mess around with the activity too much, since in this case the fragment is part of a viewpager in the activity. What if i use the this.setRetainInstance(true); on the fragment that holds the text field too?
regards, On Tuesday, June 5, 2012 3:14:58 PM UTC+1, al wrote: > > Of course I'm guessing, but I think you should change the way you transfer > the new date/time value to the text widget. > > In the activity, say A1, you create the dialog and give it a reference to > the text field of A1. When the device is rotated, the activity is recreated > (=> A2), but the dialog is not (due to this.setRetainInstance(true);). > I.e. the dialog still references the text field of A1, but you see the > activity A2. That's probably the cause of the observed behavior. As far as > I understand it, the way to go is to add a "setDateTimeField()" method to > the activity and to replace the code in the onClick method of the dialog > with something like > "((MyActivityClass)getActivity()).setDateTimeField(curDateTime()). > GetActivity() will return the current/correct activity since the dialog > will be attached to new activity as part of the configuration change. > -- 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