In one part of my application, I show the user a ListView. When the user presses an item in the list, a DialogFragment
is shown.
@Override
public void onClick() {
android.support.v4.app.FragmentTransaction ft = getFragment().getFragmentManager().beginTransaction();
ft.addToBackStack(null);
SingleSettingDialogFragment dialog = SingleSettingDialogFragment.newInstance(...);
dialog.show(ft, "Single");
}
The DialogFragment have the following structure:
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
super.onCreateDialog(savedInstanceSate);
AlertDialog dialog = new AlertDialog.Builder(...)
...
.create();
...
return dialog;
}
When the user exits the DialogFragment, I expect the onResume()
method of the calling fragment to be called, but it is not.
So what's so special about DialogFragments? Why aren't the calling Fragment paused when the Dialog is shown? And how can it be achieved?
I haven't found any reference to this behaviour in the Docs, so references is a plus.
This may help you: link
In fact a FragmentDialog is not an activity on itself but it is part of the same activity which contains the calling fragment. It means that the fragment is not paused when dialogFragment is shown.
Citing the source I gave you, a fragment is paused when: Another activity is in the foreground and has focus, but the activity in which this fragment lives is still visible (the foreground activity is partially transparent or doesn't cover the entire screen).
Hope that helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With