0
public class Movie implements Parcelable {
    private int id;
    private String poster_path;
    private String overview;
    private String release_date;
    private String original_title;
    private String backdrop_path;
    private float vote_average;
    private Review review;
    private Trailer trailer

}

I have Movie class that have two other classes which are Review and Trailer. Do I have to implements Parcelable to Review and Trailer as well ? or just root class need to implement parcelable ?

I am asking because If I do not have to do my code would be much shorter

Ankit Aggarwal
  • 5,317
  • 2
  • 30
  • 53
fiddlest
  • 1,262
  • 2
  • 17
  • 42

3 Answers3

0

Each class you include in your Parcelable must implement Parcelable. You can see an example of how to parcel a Parcelable here

Community
  • 1
  • 1
Francesc
  • 25,014
  • 10
  • 66
  • 84
0

Yes you must implement all additional method to make object Parcelable but you can try this library this will make your code simple and will do all job for you

Ihor Bykov
  • 1,843
  • 3
  • 15
  • 22
0

If you want to transfer Movie objects between different Android components, then that should be parcelable and whatever objects inside Movie class are not serializeable/parcelable , you need to make those also parcelable. Otherwise it will not work properly.

Shadab Ansari
  • 7,022
  • 2
  • 27
  • 45