DialogFragment interception rejects activity

I have activity

public class ShowFileActivity extends FragmentActivity

and when some event occurs, this class calls DialogFragment

public class ConfirmDialog extends DialogFragment

This is a simple confirmation dialog (with the "dismiss" and "ok" buttons). If the user clicked the dismissal button, I’m calling

dismiss()

and go back to ShowFileActivity. Otherwise, if the user clicks "OK", after performing some operations, after rejecting the call in the dialog box, I will return to the parent activity of ShowFileActivity. Is there a way to do this? Does DialogFragment fire any event in the parent view?

+5
source share
1 answer

, . , getActivity(), .

@Override
public void onDismiss(DialogInterface dialog) {
    ShowFileActivity parent = (ShowFileActivity) getActivity();
    parent.doWhateverYouWantWhenDialogDismissed();
}

( ) , ​​ otto greenrobot.

+8

All Articles