I am saving a key value pair before displaying the warning dialog. However the onCreateDialog()
for the dialog is called with a null bundle. Is there something extra I need to do to pass the bundle to the dialog?
MyDialogFragment testFrag= new MyDialogFragment();
Bundle args = new Bundle();
args.putString("car-type", "Audi");
testFrag.setArguments(args);
testFrag.show(getFragmentManager(), "info");
You can retrieve the arguments via DialogFragment.getArguments()
.
The savedInstanceState
is only used when a configuration change occurred. It is being filled in onSaveInstanceState(Bundle outState)
and later passed to the new DialogFragment
in onCreate()
and onCreateView()
. The first time a Fragment or Activity gets created it is null
.