title: Bundle is null after setting it in Intent
body: <p>I know there are questions like:
  <a href="https://stackoverflow.com/questions/8097267/android-intent-bundle-always-null">android-intent-bundle-always-null</a> and <a href="https://stackoverflow.com/questions/8106306/intent-bundle-returns-null-every-time">intent-bundle-returns-null-every-time</a> but there is no correct answer.</p>
  
  <p>In my <code>Activity 1</code>:</p>
  
  <pre><code>public void goToMapView(Info info) {
      Intent intent = new Intent(getApplicationContext(), MapViewActivity.class);
      //intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
      intent.putExtra("asdf", true);
      info.write(intent);
      startActivity(intent);
  }
  </code></pre>
  
  <p>In Info:</p>
  
  <pre><code>public void write(Intent intent) {
      Bundle b = new Bundle();
      b.putInt(AppConstants.ID_KEY, id);
      ... //many other attributes
      intent.putExtra(AppConstants.BUNDLE_NAME, b);
  }
  public static Info read(Bundle bundle) {
      Info info = new Info();
      info.setId(bundle.getInt(AppConstants.ID_KEY));
      ... //many other attributes
      return info;
  }
  </code></pre>
  
  <p>In MapViewActivity (<code>Activity 2</code>):</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.map_view);
  
      Bundle extras = getIntent().getBundleExtra(AppConstants.BUNDLE_NAME);
      info = Info.read(extras);
      ...
  }
  </code></pre>
  
  <p>Problem is that <code>extras</code> bundle is always null. I have debugged it and Intent (<code>intent = getIntent()</code>) has all fields set to null except one indicating what class this is (<code>MapViewActivity</code>).</p>
  
  <p>I've also tried putting the bundle via <code>intent.putExtras(b)</code> with the same effect.
  The <code>intent.putExtra("asdf", true)</code> is for debugging reasons only - I cannot get this data too (because <code>getIntent()</code> has almost all fields set to null).</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The answers below are correct and working. This was my fault. I didn't correctly passed my bundle to new intent.</p>