title: Android: How can I make a class that implements Parcelable which contains an ArrayList of a non-static custom class
body: <p>In the class I am trying to make parcelable there is a smaller class called genericSongClass. In the larger class there is an ArrayList of genericSongClass's. So I know I have to make genericSongClass parcelable, but I cannot give it a CREATOR without making the class static. Is there any way I can do this?</p>
  
  <p>My smaller class as it stands now in the current confusion:</p>
  
  <pre><code>public class genericSongClass implements Parcelable {
          String songTitle = "";
          String songArtist = "";
          String songData = "";
          String songAlbum = "";
          String isChecked = "false";
  
          public final static Parcelable.Creator&lt;genericSongClass&gt; CREATOR = new Parcelable.Creator&lt;genericSongClass&gt;() {
  
              @Override
              public genericSongClass createFromParcel(Parcel source) {
                  return null;
              }
  
              @Override
              public genericSongClass[] newArray(int size) {
                  return null;
              }
  
          };
  
          @Override
          public int describeContents() {
              return 0;
          }
  
          @Override
          public void writeToParcel(Parcel dest, int flags) {             
          }
  }
  </code></pre>
  
  <p>My Larger class (all parcelable related methods are at the bottom and the ArrayList and constructor using a parcel is at the top):</p>
  
  <pre><code>public class Music implements Parcelable{
  
      private static ArrayList&lt;genericSongClass&gt; songs = null;
  
      Cursor cursor;
  
      Context context;
  
      public Music(Context context){
          this.context = context;
      }
  
      public Music(Parcel in){
          songs = in.readArrayList(songs, genericSongClass.CREATOR);
      }
  
      public void BindAllSongs() {        
              /** Making custom drawable */
              String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0";
              final String[] projection = new String[] {
                      MediaStore.Audio.Media.DISPLAY_NAME,
                      MediaStore.Audio.Media.ARTIST,
                      MediaStore.Audio.Media.DATA,
                      MediaStore.Audio.Media.ALBUM};
                      final String sortOrder = MediaStore.Audio.AudioColumns.TITLE
                              + " COLLATE LOCALIZED ASC";
  
                      try {
                          // the uri of the table that we want to query
                          Uri uri = android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
                          // query the db
                          cursor = context.getContentResolver().query(uri,
                                  projection, selection, null, sortOrder);
                          if (cursor != null) {
                              songs = new ArrayList&lt;genericSongClass&gt;(cursor.getCount());
                              cursor.moveToFirst();                       
                              while (!cursor.isAfterLast()) { 
                                  genericSongClass GSC = new genericSongClass();
                                  GSC.songTitle = cursor.getString(0);
                                  GSC.songArtist = cursor.getString(1);   
                                  GSC.songData = cursor.getString(2);
                                  GSC.songAlbum = cursor.getString(3);
                                  songs.add(GSC);
                                  cursor.moveToNext();
                              }
                          }
                      } catch (Exception ex) {
  
                      } finally {
                          if (cursor != null) {
                              cursor.close();
                          }
                      }       
  
          }
  
      public static Object[] toArray(ArrayList&lt;Object&gt; list){
          Object[] toReturn = new Object[list.size()];
          for (int i = 0; i &lt; list.size(); i++){
              toReturn[i] = list.get(i);
          }
          return toReturn;
      }
  
      public ArrayList&lt;String&gt; getArtists(){
          ArrayList&lt;String&gt; artists = new ArrayList&lt;String&gt;();
          for(genericSongClass gsc: songs){
              if(!artists.contains(gsc.songArtist)){
                  artists.add(gsc.songArtist);
              }
          }
          Alphabetize forArtists = new Alphabetize(artists);
          return forArtists.getSortedArrayList();
      }
  
      public ArrayList&lt;String&gt; getAlbums(String artist){
          ArrayList&lt;String&gt; albums = new ArrayList&lt;String&gt;();
          for(genericSongClass gsc: songs){
              if(gsc.songArtist == artist){
                  albums.add(gsc.songAlbum);
              }
          }
          Alphabetize forAlbums = new Alphabetize(albums);
          return forAlbums.getSortedArrayList();
      }
  
      //--- Parcel ------------------------------------------------
  
       public static final Parcelable.Creator&lt;Music&gt; CREATOR = new Parcelable.Creator&lt;Music&gt;() {  
  
              public Music createFromParcel(Parcel in) {  
                  return new Music(in);  
              }
  
              @Override
              public Music[] newArray(int size) {
                  return null;
              }  
          };
  
      @Override
      public int describeContents() {
          return 0;
      }
  
      @Override
      public void writeToParcel(Parcel dest, int flags) {
          dest.writeList(songs);
      }
  
  
  
  }
  </code></pre>
  
  <p>This is my first time trying to use Parcelable, so any help is welcome! Thanks in advance!</p>