Android: Unable to put multiple values into Intent/Bundle
<p>I've been trying to use an Intent to pass multiple values (of different types) between two Activities. So far I've tried these two approaches:</p>

<pre><code>Intent intent = new Intent(context, Receiver.class);
Bundle bundle = new Bundle();
bundle.putInt("key1", v1);
bundle.putString("key2", v2);
bundle.putString("key3", v3);
bundle.putInt("key4", v4);
intent.putExtras(bundle);
</code></pre>

<p>and:</p>

<pre><code>Intent intent = new Intent(context, Receiver.class);
intent.putInt("key1", v1);
intent.putString("key2", v2);
intent.putString("key3", v3);
intent.putInt("key4", v4);
</code></pre>

<p>However, it seems only the value for <code>key1</code> is retained in both cases (when using a Bundle, it apparently only contains 1 key). What am I missing?</p>

<p><strong>Edit:</strong> This is how I retrieve the values in <code>Receiver</code>:</p>

<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video);

    Intent intent = getIntent();
    Bundle bundle = intent.getExtras();
    v1 = bundle.getInt("key1", DEFAULT1);
    v2 = bundle.getString("key2", "DEFAULT2");
    v3 = bundle.getString("key3", "DEFAULT3");
    v4 = bundle.getInt("key4", DEFAULT4);

    // ...
}
</code></pre>

<p>Alternatively:</p>

<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video);

    Intent intent = getIntent();
    v1 = intent.getIntExtra("key1", DEFAULT1);
    v2 = intent.getStringExtra("key2");
    v3 = intent.getStringExtra("key3");
    v4 = intent.getIntExtra("key4", DEFAULT2);

    // ...
}
</code></pre>

<p>When I print out the values of <code>v1</code>, <code>v2</code>, <code>v3</code>, and <code>v4</code>, <code>v1</code> is the only one with a non-null/non-default value (the value I initially put in <code>key1</code> - actually, all of the values I originally put into the Intent were non-default).</p>

<p><strong>Edit 2:</strong></p>

<p>I tried using <code>getBundleExtra()</code> like so:</p>

<pre><code>intent.putExtra("bundle", bundle);
</code></pre>

<p>And then in <code>Receiver</code>:</p>

<pre><code>Bundle bundle = intent.getBundleExtra("bundle");
</code></pre>

<p>However, <code>bundle</code> was null.</p>

<p><strong>Edit 3:</strong></p>

<p>Changing the order in which values are put in/retrieved from the Intent doesn't appear to affect anything. Nor does specifying the capacity of the Bundle. If it helps, this Intent is used in a PendingIntent.</p>