The documentation discusses how to send simple integers and strings. For example:
<argument
android:name="myIntArg"
android:defaultValue="255"
app:argType="integer" />
In the origin Fragment:
val action = OriginFragmentDirections.myAction(myInt)
findNavController().navigate(action)
In the destination Fragment:
val receivedInt = DestinationFragmentArgs.fromBundle(arguments).myIntArg
But say instead of myIntArg
, I wanted to send a list of integers (myIntListArg
). How would I do that? What app:argType
would I use in my argument?
You can add array arguments like this:
<argument
android:name="variableName"
app:argType="className[]"/>
Note that "className" must be set like "com.google.package.ClassName".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With