Reputation: 1840
I have a mutableList
.
var newList: MutableList<String> = mutableListOf()
How to pass newList
through intent?
I tried this but not working.
mIntent.putParcelableArrayListExtra("mFilePath", ArrayList(newList))
Error
Type inference failed. Expected type mismatch: required: java.util.ArrayList! found: kotlin.collections.ArrayList /* = java.util.ArrayList */
Upvotes: 3
Views: 1155
Reputation: 1840
Was able to fix it.
mIntent.putStringArrayListExtra("mFilePath", ArrayList(newList))
Upvotes: 4
Reputation: 472
you can convert it on arraylist and pass as putParcelableArrayListExtra through intent
you can create separate model class and add that model class to your arraylist and make it Parcelize through this you can achieve this@Parcelize class model:Parcelable{ }
Upvotes: 0
Reputation: 921
You can use this way
intent.putParcelableArrayListExtra("NEW_LIST", ArrayList(newList))
Upvotes: 1