I am making a data class for Parcelable.
but unable to find out a solution that, how to read integer ArrayList in Parcelable class in kotlin.
I know about String, but I face a problem in the Int type ArrayList.
var priceDetail: ArrayList<Int?>?,
for more detail see this,
data class PostCardsListData(
var arrDescriptionsTags: ArrayList<String?>?,
var priceDetail: ArrayList<Int?>?,
..........
: Parcelable {
constructor(parcel: Parcel) : this(
parcel.createStringArrayList(), // i know about string
//but how to read this Integer arraylist
this is my full data class code
import android.os.Parcel
import android.os.Parcelable
data class PostCardsListData(
var arrDescriptionsTags: ArrayList<String?>?,
var priceDetail: ArrayList<Int?>?,
) : Parcelable {
constructor(parcel: Parcel) : this(
parcel.createStringArrayList(),
parcel.//describe me what i will write here
)
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeStringList(arrDescriptionsTags)
parcel.write//describe me what i will write here
}
override fun describeContents(): Int {
return 0
}
companion object CREATOR : Parcelable.Creator<PostCardsListData> {
override fun createFromParcel(parcel: Parcel): PostCardsListData {
return PostCardsListData(parcel)
}
override fun newArray(size: Int): Array<PostCardsListData?> {
return arrayOfNulls(size)
}
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…