我正在显示一个不可取消的dialogFragment。但是当我按下主页按钮或锁定屏幕并返回我的应用程序时,dialogFragment消失了。之后我可以单击后退按钮,当我单击后退按钮并再次返回应用程序时,会再次出现对话框片段...
private void showRoutePauseDialog() {
FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
Fragment prev = getFragmentManager().findFragmentByTag(RouteActivityPausedDialogFragment.TAG);
if (prev != null) {
ft.remove(prev);
}
ft.commit();
routeActivityPausedDialogFragment = new RouteActivityPausedDialogFragment();
routeActivityPausedDialogFragment.setListener(this);
routeActivityPausedDialogFragment.setCancelable(false);
routeActivityPausedDialogFragment.show(getActivity().getSupportFragmentManager(), RouteActivityPausedDialogFragment.TAG);
}
仅在此对话框片段中发生这种情况。我在这个片段中有其他dialogFragments并且它们工作正常...我还注意到如果我显示另一个dialogFragment(一个工作正常)并按home并返回到应用程序,之后显示RouteActivityPausedDialogFragment并按Home并返回然后此dialogFragment也行得很好......