title: Retrieving data from bundles in android
body: <p>So I managed to solve a problem of retrieving information from the bundle, but I had to do something which I thought was weird. The method I tried first was this:</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {  
              super.onCreate(savedInstanceState);  
              list = savedInstanceState.getInt("listmenu");
  }
  </code></pre>
  
  <p>And this is how I am putting information into the bundle and calling the activity:</p>
  
  <pre><code>Intent myIntent = new Intent(MainActivity.this, NewActivity.class);
              myIntent.putExtra("listmenu", R.menu.listmenu);
              MainActivity.this.startActivity(myIntent);
  </code></pre>
  
  <p>But that didn't work. It would just crash on line 3, the list where I try to getInt (I couldn't find out why exactly, but it didn't work).</p>
  
  <p>Then after some googling I tried it this way:</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {  
              super.onCreate(savedInstanceState);  
              Bundle extras = getIntent().getExtras();
              list = extras.getInt("listmenu");
  }
  </code></pre>
  
  <p>It seems to me like getIntent().getExtras() would just return savedInstanceState. But if this were the case then my first method would have worked. So I must misunderstand either what savedInstanceState is, or what getIntent() does, so could someone explain what the difference between these two things is?</p>