@Test public void writeAndReadFromParcel() { Parcel parcel = Parcel.obtain(); customCommand.writeToParcel(parcel, 0); parcel.setDataPosition(0); VehicleMessage createdFromParcel = VehicleMessage.CREATOR.createFromParcel(parcel); assertThat(createdFromParcel, instanceOf(CustomCommand.class)); assertEquals(customCommand, createdFromParcel); }
@Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); final int N = commands.size(); out.writeInt(N); if (N > 0) { for (Map.Entry<String, String> entry : commands.entrySet()) { out.writeString(entry.getKey()); String dat = entry.getValue(); out.writeString(dat); } } }
CustomCommand extends KeyedMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); final int N = commands.size(); out.writeInt(N); if (N > 0) { for (Map.Entry<String, String> entry : commands.entrySet()) { out.writeString(entry.getKey()); String dat = entry.getValue(); out.writeString(dat); } } } }
CustomCommand extends KeyedMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); final int N = commands.size(); out.writeInt(N); if (N > 0) { for (Map.Entry<String, String> entry : commands.entrySet()) { out.writeString(entry.getKey()); String dat = entry.getValue(); out.writeString(dat); } } } CustomCommand(HashMap commands); protected  CustomCommand(Parcel in); protected  CustomCommand(); }
CustomCommand extends KeyedMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); final int N = commands.size(); out.writeInt(N); if (N > 0) { for (Map.Entry<String, String> entry : commands.entrySet()) { out.writeString(entry.getKey()); String dat = entry.getValue(); out.writeString(dat); } } } CustomCommand(HashMap commands); protected  CustomCommand(Parcel in); protected  CustomCommand(); HashMap<String, String> getCommands(); @Override MessageKey getKey(); @Override boolean equals(Object obj); @Override String toString(); @Override void writeToParcel(Parcel out, int flags); }
CustomCommand extends KeyedMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); final int N = commands.size(); out.writeInt(N); if (N > 0) { for (Map.Entry<String, String> entry : commands.entrySet()) { out.writeString(entry.getKey()); String dat = entry.getValue(); out.writeString(dat); } } } CustomCommand(HashMap commands); protected  CustomCommand(Parcel in); protected  CustomCommand(); HashMap<String, String> getCommands(); @Override MessageKey getKey(); @Override boolean equals(Object obj); @Override String toString(); @Override void writeToParcel(Parcel out, int flags);  }