title: Null Pointer Exception when Getting EditText Value
body: <p>I am trying to get EditText value through below code. The activity is used for adding two strings. In the layout, I already put onSave and onCancel method. But when I press button linked to onSave, it shows null pointer exception error.</p>
  
  <p>Activity:</p>
  
  <pre><code>import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.EditText;
  
  public class AddTimeActivity extends Activity {
  
  public void onCreate(Bundle savedInstanceState){
      super.onCreate(savedInstanceState);
      setContentView(R.layout.time_item);
  }
  
  public void onCancel(View view){
      this.setResult(RESULT_CANCELED);
      finish();
  }
  
  public void onSave(View view){
      Intent intent = getIntent();
  
      EditText timeView = (EditText)view.findViewById(R.id.time_view);
      String time = timeView.getText().toString();
      intent.putExtra(TimeTrackerActivity.TIME_KEY, time);
  
      EditText notesView = (EditText)view.findViewById(R.id.notes_view);
      String notes = notesView.getText().toString();
      intent.putExtra(TimeTrackerActivity.NOTES_KEY, notes);
  
      this.setResult(RESULT_OK, intent);
  
      finish();
  
  }
  }
  </code></pre>
  
  <p>Layout: </p>
  
  <pre><code>...
  &lt;EditText
      android:id="@+id/timeView"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" &gt;
  &lt;/EditText&gt;
  
  &lt;EditText
      android:id="@+id/notes_view"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:inputType="textMultiLine" 
      android:gravity="top"
      android:layout_weight="1"
      android:layout_marginBottom="10dp"/&gt;
  ...
  &lt;Button
          android:onClick="onSave"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Save" /&gt;
  
  &lt;Button
          android:onClick="onCancel"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Cancel" /&gt;
  ...
  </code></pre>
  
  <p>Error Message from Debugger</p>
  
  <pre><code>E/AndroidRuntime(1123): Caused by: java.lang.NullPointerException
  E/AndroidRuntime(1123): at com.timetracker.AddTimeActivity.onSave(AddTimeActivity.java:34)
  </code></pre>
  
  <p>I tried to check and the value of timeView through debugger and it is null.</p>
  
  <p>Could anybody help?</p>