Tuesday, 13 April 2021

If I declare a fragment in an XML layout, how do I pass it a Bundle?

I've got an activity that I've replaced with a fragment. The activity took an Intent that had some extra information on what data the activity was supposed to display.

Now that my Activity is just a wrapper around a Fragment that does the same work, how do I get that bundle to the Fragment if I declare the fragment in XML with the tag?

If I were to use a FragmentTransaction to put the Fragment into a ViewGroup, I'd get a chance to pass this info along in the Fragment constructor, but I'm wondering about the situation where the fragment is defined in XML.



from If I declare a fragment in an XML layout, how do I pass it a Bundle?

No comments:

Post a Comment