Home > front end >  How to pass a list of lists when navigating?
How to pass a list of lists when navigating?

Time:11-18

I have a list that contains lists like below

val asd:MutableList<List<String>> = mutableListOf(listOf("a","b","c"),listOf("d","e","f"))

I want to pass asd when I'm navigating to another fragment, but it seems like there's no list of lists arg type in navigation.xml. I only found list of element arg type like below

<argument
    android:name="getAnswerListFromGameFragment"
    app:argType="string[]" />

Does anyone knows how to pass list of lists when navigating?

CodePudding user response:

From the docs (https://developer.android.com/guide/navigation/navigation-pass-data) it seems that lists of lists aren't a supported argument type, you should pass a custom class you create for this purpose.

  • Related