ASampleDialogFragment extends DialogFragment { onButtonDismiss() { this.dismiss(); } onButtonRemove() { FragmentManager fm = this.getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.remove(this); ft.commit(); } }
if my intention is to dismiss the dialog I would probably call "onDismiss()" as shown in the onButtonDismiss() function. As per the documentation the "dismiss" will automatically take care of removig the dialog fragment from the stack etc. This is probably the right thing in this scenario. Also in this case the order of callbacks are onDismiss onStop onDestroyView However I see in the honeycomb preview dialog fragment example a series of dialogs are added to teh backstack and an explicit remove is called before adding the new fragment dialog adn showing it. So I thought I would try an explicit remove(fragment) as in the code above. The code seem to dismiss the dialog fine but the order of callbacks is different onStop onDestroyView onDismissDialog Essentially in this sequence if I am relying on the view in onDismissDialog the view may not be there. Just curiouse, when would one call dismiss() and when would one call remove(fragment). Thanks Satya -- 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