Advertisement
Guest User

Untitled

a guest
Apr 10th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. package com.example.psychotip;
  2.  
  3. import android.os.Parcel;
  4. import android.os.Parcelable;
  5.  
  6. public class User implements Parcelable {
  7.  
  8. public static final Parcelable.Creator<User> CREATOR = new Parcelable.Creator<User>() {
  9. public User createFromParcel (Parcel in) {
  10. return new User(in);
  11. }
  12.  
  13. public User[] newArray(int size) {
  14. return new User[size];
  15. }
  16. };
  17.  
  18. private String username;
  19. private String email;
  20. private String password;
  21. private String name;
  22. private String birthday;
  23. private String gender;
  24. private String address;
  25.  
  26. public User(String username, String email, String password) {
  27. this.username = username;
  28. this.email = email;
  29. this.password = password;
  30. this.name = "Default Name";
  31. this.birthday = "01/01/00";
  32. this.gender = "M";
  33. this.address = "Province";
  34. }
  35.  
  36. public User(Parcel in) {
  37. this.username = in.readString();
  38. this.email = in.readString();
  39. this.password = in.readString();
  40. this.name = in.readString();
  41. this.birthday = in.readString();
  42. this.gender = in.readString();
  43. this.address = in.readString();
  44. }
  45.  
  46. public void setUsername(String username) {
  47. this.username = username;
  48. }
  49.  
  50. public void setEmail(String email) {
  51. this.email = email;
  52. }
  53.  
  54. public void setPassword(String password) {
  55. this.password = password;
  56. }
  57.  
  58. public void setName(String name) {
  59. this.name = name;
  60. }
  61.  
  62. public void setBirthday(String birthday) {
  63. this.birthday = birthday;
  64. }
  65.  
  66. public void setGender(String gender) {
  67. this.gender = gender;
  68. }
  69.  
  70. public void setAddress(String address) {
  71. this.address = address;
  72. }
  73.  
  74.  
  75. public String getUsername() {
  76. return username;
  77. }
  78.  
  79. public String getEmail() {
  80. return email;
  81. }
  82.  
  83. public String getPassword() {
  84. return password;
  85. }
  86.  
  87. public String getName() {
  88. return name;
  89. }
  90.  
  91. public String getBirthday() {
  92. return birthday;
  93. }
  94.  
  95. public String getGender() {
  96. return gender;
  97. }
  98.  
  99. public String getAddress() {
  100. return address;
  101. }
  102.  
  103. public int describeContents() {
  104. return 0;
  105. }
  106.  
  107. public void writeToParcel(Parcel dest, int flags) {
  108. dest.writeString(this.username);
  109. dest.writeString(this.email);
  110. dest.writeString(this.password);
  111. dest.writeString(this.name);
  112. dest.writeString(this.birthday);
  113. dest.writeString(this.gender);
  114. dest.writeString(this.address);
  115. }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement