title: findViewById Null Pointer Exception
body: <p>Dear Stack Overflow Community, </p>
  
  <p>I'm attempting to get the date from a datepicker and set it as a string with code located outside the onCreate method. Here is my code:</p>
  
  <pre><code>DatePicker dp =(DatePicker)findViewById(R.id.datePickerControl);
  String date_picker_message= (dp.getMonth()+1) +"/"+dp.getDayOfMonth()+"/"+dp.getYear() ;
  </code></pre>
  
  <p>However, when I try to utilize this code, it complies without error but crashes with this message:</p>
  
  <p>03-30 22:51:20.719: ERROR/AndroidRuntime(4954): Caused by: java.lang.NullPointerException</p>
  
  <p>I think it could be because I haven't set the content view and my code is attempting to find a view that does not yet exist. But how would I do this outside the onCreate method? </p>
  
  <p>If I'm screaming down the highway of wrongness, please let me know and direct me towards the correct way of doing this. </p>