forked from ybin/android_notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBook.java
More file actions
44 lines (36 loc) · 830 Bytes
/
Book.java
File metadata and controls
44 lines (36 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* Book.java */
public class Book implements Parcelable {
private String mBookName;
private int mBookPrice;
public Book(String name, int price) {
mBookName = name;
mBookPrice = 42;
}
public Book(Parcel parcel) {
mBookName = parcel.readString();
mBookPrice = parcel.readInt();
}
public String getBookName() {
return mBookName;
}
public int getBookPrice() {
return mBookPrice;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeString(mBookName);
parcel.writeInt(mBookPrice);
}
public static final Parcelable.Creator<Book> CREATOR = new Creator<Book>() {
public Book createFromParcel(Parcel source) {
return new Book(source);
}
public Book[] newArray(int size) {
return new Book[size];
}
};
}