Safe Args: use list of parcelables

botflot picture botflot · Nov 28, 2018 · Viewed 11.5k times · Source

I am using the Safe Args plugin with the new Navigation components for my Android project. Now I have an argument that is an array list of parcelables, is there a way to use this with the Safe Args Plugin?

Something like app:argType=ParcelableArray. This should be possible since there are bundle methods like putParcelableArrayList().

Answer

LaVepe picture LaVepe · Dec 11, 2018

Yes, since version 1.0.0-alpha08 you can now pass arrays of parcelable objects like this:

<argument
  android:name="users"
  app:argType="com.navigation.test.User[]"/>

For passing arrays of primitive types use for e.g. app:argType="integer[]"