title: Android implement Parcelable objects with hashmap that contains another hashmap
body: <p>This is an extension for <a href="https://stackoverflow.com/questions/22498746/android-implement-parcelable-object-which-has-hashmap">Android implement Parcelable object which has hashmap</a> but mine is a little different.</p>
  
  <p>I have these classes</p>
  
  <pre><code>public class EventDetails implements Parcelable {
      Private String id;
      Private String eventName;
      Private Long eventUnixTime;
      Private HashMap &lt;String, User&gt; pickedUser = null;
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class User implements Parcelable {
      private String email;
      private String userName;
      private String userPicture;
      private Boolean hasLoggedInWithPassword;
      private HashMap&lt;String, Object&gt; dateJoined = null;
  
      public User() {
  
      }
  
      public User(String email, String userName, String userPicture, Boolean hasLoggedInWithPassword, HashMap&lt;String, Object&gt; dateJoined) {
          this.email = email;
          this.userName = userName;
          this.userPicture = userPicture;
          this.hasLoggedInWithPassword = hasLoggedInWithPassword;
          this.dateJoined = dateJoined;
      }
  
      protected User(Parcel in) {
          email = in.readString();
          userName = in.readString();
          userPicture = in.readString();
  
          int size = in.readInt();
          for (int i = 0; i &lt; size; i++) {
              String key = in.readString();
              Object value = in.readString();
              dateJoined.put(key, value);
          }
      }
  
      public static final Creator&lt;User&gt; CREATOR = new Creator&lt;User&gt;() {
          @Override
          public User createFromParcel(Parcel in) {
              return new User(in);
          }
  
          @Override
          public User[] newArray(int size) {
              return new User[size];
          }
      };
  
      public String getEmail() {
          return email;
      }
  
      public String getUserName() {
          return userName;
      }
  
      public String getUserPicture() {
          return userPicture;
      }
  
      public Boolean getHasLoggedInWithPassword() {
          return hasLoggedInWithPassword;
      }
  
      public HashMap&lt;String, Object&gt; getDateJoined() {
          return dateJoined;
      }
  
      @Override
      public int describeContents() {
          Log.i("describeUser", "describe content from User.java");
  
          return 0;
      }
  
      @Override
      public void writeToParcel(Parcel dest, int flags) {
  
          Log.i("write to Parcel", "write to Parcel from User.java");
          dest.writeString(email);
          dest.writeString(userName);
          dest.writeString(userPicture);
          dest.writeInt(hasLoggedInWithPassword ? 1:0);
  
          dest.writeInt(dateJoined.size());
          for (HashMap.Entry&lt;String, Object&gt; entry : dateJoined.entrySet()) {
              dest.writeString(entry.getKey());
              dest.writeString(String.valueOf(entry.getValue()));
          }
      }
  }
  </code></pre>
  
  <p>I'm stuck in these methods in the EventDetails class:</p>
  
  <pre><code>protected EventDetails(Parcel in) {
      id = in.readString();
      eventName = in.readString();
      eventUnixTime = in.readLong();
  
      final int size = in.readInt();
      for (int i = 0; i &lt; size; i++) {
          String key = in.readString();
          User user = in.readHashMap(userMap);
          pickedFriendsHashMap.put(key, user);
      }
  }
  
   @Override
      public void writeToParcel(Parcel dest, int flags) {
  
          dest.writeInt(pickedFriendsHashMap.size());
  
          for (HashMap.Entry&lt;String, User&gt; entry :    pickedFriendsHashMap.entrySet()) {
              dest.writeString(entry.getKey());
  
          dest.writeInt(listLength);
  
          for (User user: userList) {
              dest.writeParcelable(user, 0);
          }
      }
  
      dest.writeString(id);
      dest.writeString(eventName);
      dest.writeLong(eventUnixTime);
  }
  </code></pre>
  
  <p>Please advise how I can properly put these classes in parcels and send in bundle.</p>
  
  <p>Thank you.</p>
  
  <p>-R</p>