title: How to make an inner class Parcelable
body: <p>I need to know how to make an inner class Parcelable so that objects of its type can be passed via AIDL to a remote service. I cannot find any information on this.</p>
  
  <p>Here is example code of what I am trying to accomplish, but it doesn't compile because the CREATOR in the Bar class cannot be static (ie because it's in an inner class). I cannot make Bar a static inner class and I cannot move Bar outside of the Foo class (other dependencies within the system). I also need to know how I would reference the Bar class from within an AIDL file. Any help is greatly appreciated.</p>
  
  <pre><code>public class Foo implements Parcelable
  {
      private int a;
  
      public Foo()
      {
      }
  
      public Foo(Parcel source)
      {
          this.a = source.readInt();
      }
  
      public int describeContents()
      {
          return 0;
      }
  
      public void writeToParcel(Parcel dest, int flags)
      {
          dest.writeInt(this.a);
      }
  
      public static final Parcelable.Creator&lt;Foo&gt; CREATOR
      = new Parcelable.Creator&lt;Foo&gt;()
      {
          ...
      }
  
      public class Bar implements Parcelable
      {
          private int b;
  
          public Bar()
          {
          }
  
          public Bar(Parcel source)
          {
              this.b = source.readInt();
          }
  
          public int describeContents()
          {
              return 0;
          }
  
          public void writeToParcel(Parcel dest, int flags)
          {
              dest.writeInt(this.b);
          }
  
          public static final Parcelable.Creator&lt;Bar&gt; CREATOR
          = new Parcelable.Creator&lt;Bar&gt;()
          {
              ...
          }
      }
  }
  </code></pre>