title: Android Parcelable Problem with array
body: <p>Hi everybody i have build a class that implements Parcelable but one of the arraylist attributes i have define gets empty when i read the class. Here is the code</p>
  
  <pre><code>package roblestech.laCartelera;
  
  import java.util.ArrayList;
  import android.os.Parcel;
  import android.os.Parcelable;
  
  public class ProgramacionPelicula implements Parcelable {
  
      public ProgramacionPelicula() {
      }
  
      public ProgramacionPelicula(Pelicula pelicula) {
          _pelicula = pelicula;
      }
  
      public ProgramacionPelicula(Cine cine) {
          _cine = cine;
      }
  
      public String toString() {
          if (getVista() == ProgramacionPelicula.VISTA_PELICULA) {
              return getCine().getCine();
          } else {
              return getPelicula().getTituloOriginal();
          }
      }
      private int _idProgramacion;
  
      public void setIdProgramacion(int value) {
          _idProgramacion = value;
      }
  
      public int getIdProgramacion() {
          return _idProgramacion;
      }
      private Pelicula _pelicula;
  //  public ArrayList&lt;Pelicula&gt; _peliculas = new ArrayList&lt;Pelicula&gt;();
  
      public void setPelicula(Pelicula pelicula) {
          _pelicula = pelicula;
      }
  
      public Pelicula getPelicula() {
          return _pelicula;
      }
      private Cine _cine;
  
      public void setCine(Cine cine) {
          _cine = cine;
      }
  
      public Cine getCine() {
          return _cine;
      }
      public ArrayList&lt;Tanda&gt; _tandas = new ArrayList&lt;Tanda&gt;();
  
      public void setTandas(ArrayList&lt;Tanda&gt; value) {
          _tandas = value;
      }
  
      public void setTandas(Object[] tandas) {
          for (Object tanda : tandas) {
              if (tanda instanceof Tanda) {
                  _tandas.add((Tanda) tanda);
              }
          }
      }
  
      public void addTanda(Tanda value) {
          _tandas.add(value);
      }
  
      public ArrayList&lt;Tanda&gt; getTandas() {
          return _tandas;
      }
      private String _sala = "";
  
      public void setSala(String value) {
          _sala = value;
      }
  
      public String getSala() {
          return _sala;
      }
      public static final int VISTA_CINE = 0;
      public static final int VISTA_PELICULA = 1;
      private int _vista = VISTA_CINE;
  
      public int getVista() {
          return _vista;
      }
  
      public ProgramacionPelicula toPelicula() {
          ProgramacionPelicula programacionPelicula = new ProgramacionPelicula();
          programacionPelicula._idProgramacion = _idProgramacion;
          programacionPelicula._pelicula = _pelicula;
          programacionPelicula._cine = _cine;
          programacionPelicula._tandas = _tandas;
          programacionPelicula._sala = _sala;
          programacionPelicula._vista = VISTA_PELICULA;
  
          return programacionPelicula;
      }
  
      @Override
      public int describeContents() {
          // TODO Auto-generated method stub
          return 0;
      }
  
      @Override
      public void writeToParcel(Parcel dest, int flags) {
  
          dest.writeInt(getIdProgramacion());
          dest.writeString(getSala());
  
          ArrayList&lt;Pelicula&gt; peliculas = new ArrayList&lt;Pelicula&gt;();
          peliculas.add(getPelicula());
  
          Object[] objectsPeliculas = peliculas.toArray();
          dest.writeArray(objectsPeliculas);
  
          Object[] objectsTanda = getTandas().toArray();
          dest.writeArray(objectsTanda);
  
  
  
      }
      // this is used to regenerate your object. All Parcelables must have a
      // CREATOR that implements these two methods
      public static final Parcelable.Creator&lt;ProgramacionPelicula&gt; CREATOR = new Parcelable.Creator&lt;ProgramacionPelicula&gt;() {
  
          public ProgramacionPelicula createFromParcel(Parcel in) {
              return new ProgramacionPelicula(in);
          }
  
          public ProgramacionPelicula[] newArray(int size) {
              return new ProgramacionPelicula[size];
          }
      };
  
      // example constructor that takes a Parcel and gives you an object populated
      // with it's values
      private ProgramacionPelicula(Parcel in) {
          this();
          setIdProgramacion(in.readInt());
          setSala(in.readString());
  
          Object[] obj = in.readArray(Pelicula.class.getClassLoader());
          setPelicula((Pelicula) obj[0]);
          setTandas(in.readArray(Tanda.class.getClassLoader()));
  
  
      }
  }
  </code></pre>
  
  <p>Thanks in advance everybody.</p>