All fields (ArrayList<Photo>
and Profil
in my example) Must Implement Serializable
Parcelable encountered IOException writing serializable object (name = com.x.beans.Album)
-
16-07-2023 - |
سؤال
Aim & Problem : I need to past an Object ArrayList in my Intent .. so i know that my Class must Implement a Serializable, but when i have tried to do that i get the following exception :
Exception : Parcelable encountered IOException writing serializable object (name =
com.x.beans.Album)
Album.java
@JsonIgnoreProperties(ignoreUnknown=true)
public class Album implements Serializable{
@JsonProperty
private Integer id;
@JsonProperty
private Profil profil;
@JsonProperty
private String nom;
@JsonProperty
private String ext;
@JsonProperty
private ArrayList<Photo> photos;
public Album() {
}
public Album(Profil profil, String ext) {
this.profil = profil;
this.ext = ext;
}
public Album(Profil profil, String nom, String ext, ArrayList<Photo> photos) {
this.profil = profil;
this.nom = nom;
this.ext = ext;
this.photos = photos;
}
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Profil getProfil() {
return this.profil;
}
public void setProfil(Profil profil) {
this.profil = profil;
}
public String getNom() {
return this.nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getExt() {
return this.ext;
}
public void setExt(String ext) {
this.ext = ext;
}
public ArrayList<Photo> getPhotos() {
return this.photos;
}
public void setPhotos( ArrayList<Photo> photos) {
this.photos = photos;
}
}
المحلول
لا تنتمي إلى StackOverflow