I haven\'t found something like setTag(String tagName)
method in the Fragment
class. The only way to set a Fragment
tag that I have fo
Nowadays there's a simpler way to achieve this if you are using a DialogFragment
(not a Fragment
):
val yourDialogFragment = YourDialogFragment()
yourDialogFragment.show(
activity.supportFragmentManager,
"YOUR_TAG_FRAGMENT"
)
Under the hood, the show()
method does create a FragmentTransaction
and adds the tag by using the add()
method. But it's much more convenient to use the show()
method in my opinion.
You could shorten it for Fragment
too, by using a Kotlin Extension :)