title: Getting getParcelableArrayListExtra returns in NullPointerException?
body: <p>The Parcelable class is : </p>
  
  <pre><code> package mobile.bh.classes;
  
  import java.util.List;
  
  import mobile.bh.activities.MethodStep;
  import android.content.Context;
  import android.graphics.Bitmap;
  import android.os.Parcel;
  import android.os.Parcelable;
  
  //simple class that just has one member property as an example
  public class Recipe implements Parcelable {
      public int id;
      public String name;
      public List&lt;Ingredient&gt; ingredients;
      public List&lt;MethodStep&gt; method;
      public String comment;
      public String image;
      public Bitmap image2;
      Context mContext;
  
  
  
      public Recipe(Context c){
          mContext = c;
      }
      /* everything below here is for implementing Parcelable */
  
      // 99.9% of the time you can just ignore this
      public int describeContents() {
          return 0;
      }
  
      // write your object's data to the passed-in Parcel
      public void writeToParcel(Parcel out, int flags) {
          out.writeInt(id);
          out.writeString(name);
          out.writeTypedList(ingredients);
          out.writeTypedList(method);
          out.writeString(comment);
          out.writeString(image);
      }
  
      // this is used to regenerate your object. All Parcelables must have a CREATOR that implements these two methods
      public static final Parcelable.Creator&lt;Recipe&gt; CREATOR = new Parcelable.Creator&lt;Recipe&gt;() {
          public Recipe createFromParcel(Parcel in) {
              return new Recipe(in);
          }
  
          public Recipe[] newArray(int size) {
              return new Recipe[size];
          }
      };
  
      // example constructor that takes a Parcel and gives you an object populated with it's values
      private Recipe(Parcel in) {
          id = in.readInt();
          name =in.readString();
          in.readTypedList(ingredients, Ingredient.CREATOR);
          in.readTypedList(method, MethodStep.CREATOR);
          comment = in.readString();
          image = in.readString();
      }
  
  }
  </code></pre>
  
  <p>the data is sent though the intent like this : </p>
  
  <pre><code>            Intent i = new Intent(context,RecipeInfoActivity.class);
          ArrayList&lt;Recipe&gt; dataList = new ArrayList&lt;Recipe&gt;();
          dataList.add(recipe);
          i.putParcelableArrayListExtra("recipeObj", dataList);
          i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          context.startActivity(i);
  </code></pre>
  
  <p>and receiving the data in otherside, and this make NullPointerExceotion </p>
  
  <pre><code>    ArrayList&lt;Recipe&gt; p =  getIntent().getParcelableArrayListExtra("recipeObj");
  </code></pre>
  
  <p>LogCat output:</p>
  
  <pre><code>08-24 16:37:51.172: E/AndroidRuntime(976): FATAL EXCEPTION: main
  08-24 16:37:51.172: E/AndroidRuntime(976): java.lang.RuntimeException: Unable to start activity ComponentInfo{mobile.bh/mobile.bh.activities.RecipeInfoActivity}: java.lang.NullPointerException
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.os.Handler.dispatchMessage(Handler.java:99)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.os.Looper.loop(Looper.java:123)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.app.ActivityThread.main(ActivityThread.java:4627)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at java.lang.reflect.Method.invokeNative(Native Method)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at java.lang.reflect.Method.invoke(Method.java:521)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at dalvik.system.NativeStart.main(Native Method)
  08-24 16:37:51.172: E/AndroidRuntime(976): Caused by: java.lang.NullPointerException
  08-24 16:37:51.172: E/AndroidRuntime(976):  at mobile.bh.classes.Recipe.&lt;init&gt;(Recipe.java:59)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at mobile.bh.classes.Recipe.&lt;init&gt;(Recipe.java:56)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at mobile.bh.classes.Recipe$1.createFromParcel(Recipe.java:47)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at mobile.bh.classes.Recipe$1.createFromParcel(Recipe.java:1)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.os.Parcel.readParcelable(Parcel.java:1906)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.os.Parcel.readValue(Parcel.java:1771)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.os.Parcel.readListInternal(Parcel.java:2017)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.os.Parcel.readArrayList(Parcel.java:1461)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.os.Parcel.readValue(Parcel.java:1792)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.os.Parcel.readMapInternal(Parcel.java:2008)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.os.Bundle.unparcel(Bundle.java:208)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.os.Bundle.getParcelableArrayList(Bundle.java:1144)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.content.Intent.getParcelableArrayListExtra(Intent.java:3424)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at mobile.bh.activities.RecipeInfoActivity.onCreate(RecipeInfoActivity.java:56)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  08-24 16:37:51.172: E/AndroidRuntime(976):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
  08-24 16:37:51.172: E/AndroidRuntime(976):  ... 11 more
  </code></pre>