@cxm-2016
2016-08-16T08:58:46.000000Z
字数 525
阅读 1902
android
no
data class UserBean(
var name: String,
var age: Int
) : Parcelable {
constructor(source: Parcel) : this(source.readString(), source.readInt())
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel?, flags: Int) {
dest?.writeString(name)
dest?.writeInt(age)
}
companion object {
@JvmField val CREATOR: Parcelable.Creator<UserBean> = object : Parcelable.Creator<UserBean> {
override fun createFromParcel(source: Parcel): UserBean = UserBean(source)
override fun newArray(size: Int): Array<UserBean?> = arrayOfNulls(size)
}
}
}