title: Intent putExtra ArrayList<NameValuePair>
body: <p>Does anyone know how to add an <code>ArrayList&lt;NameValuePair&gt;</code> to an Intent as an extra?</p>
  
  <pre><code>ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();
  nameValuePairs.add(new BasicNameValuePair("first_name", first_name));
  nameValuePairs.add(new BasicNameValuePair("last_name", last_name));
  nameValuePairs.add(new BasicNameValuePair("email", email));
  nameValuePairs.add(new BasicNameValuePair("password", password));
  
  /* Move on to step 2 */
  Intent intent = new Intent(RegisterActivity1.this, RegisterActivity2.class);
  intent.putExtra("nvp", nameValuePairs);
  startActivity(intent);
  </code></pre>
  
  <p>Here is the class declaration for RegisterActivity2:</p>
  
  <pre><code>public class RegisterActivity2 extends Activity implements Serializable {
  }
  </code></pre>
  
  <p>The error in the logcat is:</p>
  
  <pre><code>&gt; Parcel: unable to marshal value first_name="whatever"
  </code></pre>
  
  <p>After implementing the suggestion by Ted Hopp, I still get an error. Here is the stack trace:</p>
  
  <blockquote>
    <p></p>
  </blockquote>
  
  <pre><code>08-04 22:10:16.095: E/AndroidRuntime(5065): FATAL EXCEPTION: main
  &gt; 08-04 22:10:16.095: E/AndroidRuntime(5065):
  &gt; java.lang.RuntimeException: Unable to start activity
  &gt; ComponentInfo{/.RegisterActivity2}: java.lang.RuntimeException:
  &gt; Parcelable encountered IOException reading a Serializable object (name
  &gt; = database.NVP) 08-04 22:10:16.095: E/AndroidRuntime(5065):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2070)
  &gt; 08-04 22:10:16.095: E/AndroidRuntime(5065):   at
  &gt; android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2095)
  &gt; 08-04 22:10:16.095: E/AndroidRuntime(5065):   at
  &gt; android.app.ActivityThread.access$600(ActivityThread.java:135) 08-04
  &gt; 22:10:16.095: E/AndroidRuntime(5065):     at
  &gt; android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201)
  &gt; 08-04 22:10:16.095: E/AndroidRuntime(5065):   at
  &gt; android.os.Handler.dispatchMessage(Handler.java:99) 08-04
  &gt; 22:10:16.095: E/AndroidRuntime(5065):     at
  &gt; android.os.Looper.loop(Looper.java:137) 08-04 22:10:16.095:
  &gt; E/AndroidRuntime(5065):   at
  &gt; android.app.ActivityThread.main(ActivityThread.java:4849) 08-04
  &gt; 22:10:16.095: E/AndroidRuntime(5065):     at
  &gt; java.lang.reflect.Method.invokeNative(Native Method) 08-04
  &gt; 22:10:16.095: E/AndroidRuntime(5065):     at
  &gt; java.lang.reflect.Method.invoke(Method.java:511) 08-04 22:10:16.095:
  &gt; E/AndroidRuntime(5065):   at
  &gt; com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
  &gt; 08-04 22:10:16.095: E/AndroidRuntime(5065):   at
  &gt; com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562) 08-04
  &gt; 22:10:16.095: E/AndroidRuntime(5065):     at
  &gt; dalvik.system.NativeStart.main(Native Method) 08-04 22:10:16.095:
  &gt; E/AndroidRuntime(5065): Caused by: java.lang.RuntimeException:
  &gt; Parcelable encountered IOException reading a Serializable object (name
  &gt; = database.NVP) 08-04 22:10:16.095: E/AndroidRuntime(5065):   at android.os.Parcel.readSerializable(Parcel.java:2144) 08-04
  &gt; 22:10:16.095: E/AndroidRuntime(5065):     at
  &gt; android.os.Parcel.readValue(Parcel.java:2016) 08-04 22:10:16.095:
  &gt; E/AndroidRuntime(5065):   at
  &gt; android.os.Parcel.readListInternal(Parcel.java:2235) 08-04
  &gt; 22:10:16.095: E/AndroidRuntime(5065):     at
  &gt; android.os.Parcel.readArrayList(Parcel.java:1655) 08-04 22:10:16.095:
  &gt; E/AndroidRuntime(5065):   at
  &gt; android.os.Parcel.readValue(Parcel.java:1986) 08-04 22:10:16.095:
  &gt; E/AndroidRuntime(5065):   at
  &gt; android.os.Parcel.readMapInternal(Parcel.java:2226) 08-04
  &gt; 22:10:16.095: E/AndroidRuntime(5065):     at
  &gt; android.os.Bundle.unparcel(Bundle.java:223) 08-04 22:10:16.095:
  &gt; E/AndroidRuntime(5065):   at
  &gt; android.os.Bundle.getSerializable(Bundle.java:1254) 08-04
  &gt; 22:10:16.095: E/AndroidRuntime(5065):     at
  &gt; android.content.Intent.getSerializableExtra(Intent.java:4268) 08-04
  &gt; 22:10:16.095: E/AndroidRuntime(5065):     at
  &gt; .RegisterActivity2.onCreate(RegisterActivity2.java:24) 08-04
  &gt; 22:10:16.095: E/AndroidRuntime(5065):     at
  &gt; android.app.Activity.performCreate(Activity.java:5244) 08-04
  &gt; 22:10:16.095: E/AndroidRuntime(5065):     at
  &gt; android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1082)
  &gt; 08-04 22:10:16.095: E/AndroidRuntime(5065):   at
  &gt; android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2034)
  &gt; 08-04 22:10:16.095: E/AndroidRuntime(5065):   ... 11 more 08-04
  &gt; 22:10:16.095: E/AndroidRuntime(5065): Caused by:
  &gt; java.io.InvalidClassException:
  &gt; org.apache.http.message.BasicNameValuePair; IllegalAccessException
  &gt; 08-04 22:10:16.095: E/AndroidRuntime(5065):   at
  &gt; java.io.ObjectStreamClass.resolveConstructorClass(ObjectStreamClass.java:694)
  &gt; 08-04 22:10:16.095: E/AndroidRuntime(5065):   at
  &gt; java.io.ObjectStreamClass.newInstance(ObjectStreamClass.java:655)
  &gt; 08-04 22:10:16.095: E/AndroidRuntime(5065):   at
  &gt; java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1816)
  &gt; 08-04 22:10:16.095: E/AndroidRuntime(5065):   at
  &gt; java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:787)
  &gt; 08-04 22:10:16.095: E/AndroidRuntime(5065):   at
  &gt; java.io.ObjectInputStream.readObject(ObjectInputStream.java:2003)
  &gt; 08-04 22:10:16.095: E/AndroidRuntime(5065):   at
  &gt; java.io.ObjectInputStream.readObject(ObjectInputStream.java:1960)
  &gt; 08-04 22:10:16.095: E/AndroidRuntime(5065):   at
  &gt; android.os.Parcel.readSerializable(Parcel.java:2142) 08-04
  &gt; 22:10:16.095: E/AndroidRuntime(5065):     ... 23 more
  </code></pre>