title: Where does the Android Parcelable interface enforce the CREATOR object
body: <p>I am working with Parcelables in Android and I was curious about this error...</p>
  
  <blockquote>
    <p>11-23 16:17:07.174: E/AndroidRuntime(1277): Caused by: android.os.BadParcelableException: Parcelable protocol requires a Parcelable.Creator object called  CREATOR on class com.gleason.apahelper.model.PlayerTeam</p>
  </blockquote>
  
  <p>Of course this is because I am missing this...</p>
  
  <pre><code>public static final Parcelable.Creator&lt;Player&gt; CREATOR = new Parcelable.Creator&lt;Player&gt;() {
      public Player createFromParcel(Parcel in) {
        return new Player(in);
      }
      public Player[] newArray(int size) {
        return new Player[size];
      }
  };
  </code></pre>
  
  <p>My question is, when I look at the code <a href="https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/os/Parcelable.java" rel="nofollow">here</a> I can't tell how it makes sure you have the CREATOR object. I can see where is requires the interface but I don't see where it requires the CREATOR name. Can someone explain this a little better? I would like to use this pattern in other code I am writing so I was wondering if someone could explain it.</p>