title: Trying to initialize widgets in Android using a separate class, getting a NullPointerException
body: <p>I am trying to pull logic in my application into a separate class to reuse the logic within my application, and I am not sure if what I want to do is possible.  I understand I need to call the setContentView function in PercentageCalc.java in order to have the values not be null, but is there any way to pass that through in the Keypad class?</p>
  
  <p>The NullPointerException comes in the first line of the Keypad class.</p>
  
  <p><strong>PercentageCalc.java</strong></p>
  
  <pre><code>Keypad keypad = new Keypad();
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.percentage_calc);
  
      /** Initialize variables for widget handles */
      ...
      keypad.initializeWidgets();
  }
  </code></pre>
  
  <p><strong>Keypad.java</strong></p>
  
  <pre><code>Button button_1, button_2, button_3, button_4, button_5, button_6, button_7, button_8,
          button_9, button_0, button_clr, button_del, button_period;
  
  public void initializeWidgets()
  {
      button_1 = (Button)findViewById(R.id.b_1);
      button_2 = (Button)findViewById(R.id.b_2);
      button_3 = (Button)findViewById(R.id.b_3);
      button_4 = (Button)findViewById(R.id.b_4);
      button_5 = (Button)findViewById(R.id.b_5);
      button_6 = (Button)findViewById(R.id.b_6);
      button_7 = (Button)findViewById(R.id.b_7);
      button_8 = (Button)findViewById(R.id.b_8);
      button_9 = (Button)findViewById(R.id.b_9);
      button_clr = (Button)findViewById(R.id.b_clr);
      button_0 = (Button)findViewById(R.id.b_0);
      button_del = (Button)findViewById(R.id.b_del);
      button_period = (Button)findViewById(R.id.b_period);
  }
  </code></pre>