public class Book implements Parcelable {
public int bookId;
public String bookName;
public Book(int bookId, String bookName) {
this.bookId = bookId;
this.bookName = bookName;
}
public int describeContents() {
return 0;
}
public void writeToParcel(Parcel out, int flags) {
out.writeInt(bookId);
out.writeString(bookName);
}
public static final Parcelable.Creator<Book> CREATOR = new Creator<Book>() {
@Override
public Book createFromParcel(Parcel parcel) {
return new Book(parcel);
}
@Override
public Book[] newArray(int i) {
return new Book[i];
}
};
private Book(Parcel in) {
bookId = in.readInt();
bookName = in.readString();
}
}
android-Parcelable
Author: tea9
Permalink: http://tea9.github.io/post/2098168253.html
License: Copyright (c) 2017-2025 CC-BY-NC-4.0 LICENSE
Slogan: Do you believe in DESTINY?