Opening Fragment from a DialogFragment (replacing the Dialogs parent)
问题 Let's say I have Fragment A, from which I open a DialogFragment like this: FragmentActivity fragmentActivity = (FragmentActivity) view.getContext(); FragmentTransaction ft = fragmentActivity.getSupportFragmentManager().beginTransaction(); Fragment prev = fragmentActivity.getSupportFragmentManager().findFragmentByTag("dialog"); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); DialogFragment fragmentDialog = MyDialogFragment.newInstance(); fragmentDialog.show(ft, "dialog"); From