You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is an issue if you would try to pass an ArrayList with this library, CustomElement has annotation @parcelize and extends Parcelable.
For single element it's correctly generating fill method in x*Starter class for example it would look like: activity.setCustomElement((CustomElement)savedInstanceState.getParcelable(CUSTOM_ELEMENT_KEY));
But for an ArrayList of this CustomElement it look like: activity.setCustomElements(savedInstanceState.getParcelableArrayList(CUSTOM_ELEMENTS_KEY));
And Android Studio marks it as error.
The text was updated successfully, but these errors were encountered:
savedInstanceState is a Bundle which has getParcelableArrayList method and this is preferred way to pass list of elements as an argument. It is even tested. Can you give some more specific example?
I've downloaded your sample, tested it and it's not @parcelize annotation problem. To see what I mean just add in StudentParcelableActivity.kt the following line.
@get:Arg var students: ArrayList<StudentParcelable> by argExtra()
Your library work correctly in Kotlin for: @get:Arg val students: ArrayList<StudentParcelable> by argExtra()
but it's not working for: @get:Arg var students: ArrayList<StudentParcelable> by argExtra()
It's the problem of var in case of ArrayList with elements that extends Parcelable.
btwarog
changed the title
KAE Parcelize annotation
var ArrayList of Parcelable problem
Mar 19, 2018
Library version 1.11-beta
There is an issue if you would try to pass an ArrayList with this library, CustomElement has annotation @parcelize and extends Parcelable.
For single element it's correctly generating fill method in x*Starter class for example it would look like:
activity.setCustomElement((CustomElement)savedInstanceState.getParcelable(CUSTOM_ELEMENT_KEY));
But for an ArrayList of this CustomElement it look like:
activity.setCustomElements(savedInstanceState.getParcelableArrayList(CUSTOM_ELEMENTS_KEY));
And Android Studio marks it as error.
The text was updated successfully, but these errors were encountered: