I have a complex class that I used a @Parcelable (Im using the Parceler library https://github.com/johncarl81/parceler)
@Parcel
public class Event {
public int id;
public String title;
public String description;
public String resourceURL;
public List<Url> urls;
public Date modified;
public Date start;
public Date end;
public ImageInfo thumbnail;
public ItemList comics;
public ItemList stories;
public ItemList series;
public CharacterList characters;
public CreatorList creators;
public Item next;
public Item previous;
}
The class has many other objects, but theyre mostly strings.
I wrapped it in my main activity like:
Intent intent = new Intent(getApplicationContext(), EventDescriptionActivity.class);
Bundle bundle = new Bundle();
bundle.putParcelable("event", Parcels.wrap(eventList.get(position)));
intent.putExtras(bundle);
startActivity(intent);
I have an List of events (eventList) and im trying to send one object in the list to another activity.
I unwrap it in my other activity like:
Event event = Parcels.unwrap(this.getIntent().getExtras().get("event"));
Inside my onCreate()
But i get a red line under my parameter saying:
"unwrap (android.os.Parcelable) in Parcels cannot be applied to (java.lang.Object)"