title: Android NullPointerException for passing parameter from Activity
body: <p>My app starts from <code>activity1</code>, then jumps to <code>activity2</code>, where I get the value of a String, and jump back to <code>activity1</code>. The problem is, when I try to pass the String value back, I've got <code>NullPointerException</code> error in <code>activity1</code> for getting the data value. I debugged to find the data value is correct in <code>activity2</code>. Please help me to set some flags to distinguish the initial launch of the app in <code>activity1</code> and second time jumped back to it from <code>activiy2</code>. Thanks a lot!</p>
  
  <pre><code>String data = (String) getIntent().getExtras().get("data"); 
  if(data != null){
     Toast.makeText(this, data, Toast.LENGTH_SHORT).show();
  }else{
     Toast.makeText(this, "no data", Toast.LENGTH_SHORT).show();
  } 
  </code></pre>