我试图将我的对象类 GastronomyElement 发送到另一个活动,但我收到了这个错误
java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.example.despegarteproject.classes.GastronomyElement)
我看过其他类似的帖子,但我无法解决。这是我的课程代码
public class GastronomyElement implements Serializable {
String id, name, formattedAddress, formattedPhoneNumber, reference, photo;
List<String> photos;
Boolean openNow;
Horarios horarios;
List<Review> reviews;
String priceLevel;
double latitude, longitude;
Double rating;
public String getName () {
return name;
}
public void setName (String name) {
this.name = name;
}
public String getId () {
return id;
}
public void setId (String id) {
this.id = id;
}
public String getFormattedAddress () {
return formattedAddress;
}
public void setFormattedAddress (String formattedAddress) {
this.formattedAddress = formattedAddress;
}
public String getReference () {
return reference;
}
public void setReference (String reference) {
this.reference = reference;
}
public String getPhoto () {
return photo;
}
public void setPhoto (String photo) {
this.photo = photo;
}
public List<String> getPhotos () {
return photos;
}
public void setPhotos (List<String> photos) {
this.photos = photos;
}
public double getLatitude() {
return latitude;
}
public void setLatitude (double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude (double longitude) {
this.longitude = longitude;
}
public Double getRating () {
return rating;
}
public void setRating (Double rating) {
this.rating = rating;
}
public Boolean getOpenNow () {
return openNow;
}
public void setOpenNow (Boolean openNow) {
this.openNow = openNow;
}
public Horarios getHorarios () {
return horarios;
}
public void setHorarios (Horarios horarios) {
this.horarios = horarios;
}
public String getPriceLevel () {
return priceLevel;
}
public void setPriceLevel (String priceLevel) {
this.priceLevel = priceLevel;
}
public String getFormattedPhoneNumber () {
return formattedPhoneNumber;
}
public void setFormattedPhoneNumber (String formattedPhoneNumber) {
this.formattedPhoneNumber = formattedPhoneNumber;
}
public List<Review> getReviews () {
return reviews;
}
public void setReviews (List<Review> reviews) {
this.reviews = reviews;
}
}
这就是我发送它的方式
Intent act = new Intent (context, ActivityLugarDetalles.class);
act.putExtra("elementDetails", elementDetails);
startActivity(act);
我会很感激你的帮助!谢谢你!