In the official example http://developer.android.com/reference/android/app/DialogFragment.html#BasicDialog the fragment is being created with use of static factory method that wraps arguments in a Bundle and calls no-args constructor passing args with setArguments(bundle)- so my question is – why not simply make public constructor with these arguments? What is the reason for using getArguments/setArguments fragment’s methods – is maybe Dialog not guaranteed to be recreated each time, but reused? if so then when it is happening?
Thanks in advance.
In the official example http://developer.android.com/reference/android/app/DialogFragment.html#BasicDialog the fragment is being created with use of static
Share
Enforcing a no-arguments, default constructor pattern allows the system to re-create the fragment dynamically when necessary. From the docs:
“will often” and “in some cases” leaves it vague. But short of satisfying your curiosity … arguments it is!