Android DialogFragment的onCreateView中保存的实例束为空

Android DialogFragment的onCreateView中保存的实例束为空,android,fragment,bundle,Android,Fragment,Bundle,在显示警告对话框之前,我正在保存一个键值对。但是,对话框的onCreateDialog()是用空绑定调用的。我需要做些额外的事情来将包传递给对话框吗 MyDialogFragment testFrag= new MyDialogFragment(); Bundle args = new Bundle(); args.putString("car-type", "Audi"); testFrag.setArguments(args); testFrag.show(getFragmentManage

在显示警告对话框之前,我正在保存一个键值对。但是,对话框的
onCreateDialog()
是用空绑定调用的。我需要做些额外的事情来将包传递给对话框吗

MyDialogFragment testFrag= new MyDialogFragment();
Bundle args = new Bundle();
args.putString("car-type", "Audi");
testFrag.setArguments(args);
testFrag.show(getFragmentManager(), "info");

您可以通过
DialogFragment.getArguments()
检索参数


savedInstanceState
仅在发生配置更改时使用。它被填入
onSaveInstanceState(Bundle outState)
,然后被传递到
onCreate()
onCreateView()
中的新
对话框fragment
。第一次创建片段或活动时,它是
null

使用
getArguments
检索
setArguments
捆绑包

作为
onCreateDialog
方法参数的
savedInstanceState
捆绑包是在
onSaveInstanceState
中填充的捆绑包

这两个完全无关