Я нашел решение, на случай, если кому-то еще понадобится помощь. Вот рабочий код, где мой Map
имеет значение Map<String,Document>
, где Документ - это другое Pojo
.
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeByte((byte) (driverDocuments == null ? 0x00 : 0x01));
if (driverDocuments != null) {
dest.writeInt(this.driverDocuments.size());
for (Map.Entry<String, Document> entry : this.driverDocuments.entrySet()) {
dest.writeString(entry.getKey());
dest.writeSerializable(entry.getValue());
}
}
}
и * 1007.*
protected Model(Parcel in) {
if (in.readByte() == 0X01) {
int documentSize = in.readInt();
this.driverDocuments = new HashMap<String, Document>(documentSize);
for (int i = 0; i < documentSize; i++) {
String key = in.readString();
Document value = (Document) in.readSerializable();
this.driverDocuments.put(key, value);
}
} else
driverDocuments = null;
}