title: Android - OnClickListener - Constructor Not Being Called
body: <p>This is my first question.  Usually I can find my answers through Gogle which usually just brings me to stackoverflow anyways, but this finally pushed me far enough to ask my own question, probably so obvious nobody needed to ask it before!</p>
  
  <p>Anyways, this isn't for anything in particular. Just trying to get a handle on <code>onlicklisteners</code>.  In this case, specifically inner-class <code>onclicklisteners</code>.  </p>
  
  <p><strong>Problem:</strong> Why is the program skipping over the constructor for <code>MathButtonClicked</code>?
  I was it a <code>CharSequence</code>, but the constructor never gets called (I know this via the logcat).</p>
  
  <pre><code>public class Main extends Activity {
  
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      Button mathButton = (Button) findViewById(R.id.mathButton);
      EditText et = (EditText) findViewById(R.id.inputText);
      CharSequence inputText = et.getText().toString();
  
  
      mathButton.setOnClickListener(new MathButtonClicked(inputText));
  }
  
  private class MathButtonClicked implements OnClickListener {
      private CharSequence receivedText;
  
      public MathButtonClicked(CharSequence inputText) {
          this.receivedText=inputText;
          Log.d("Constructor", " " + receivedText);
      }
  
  
  
      public void onClick(View v) {
          Log.d("Onclick", " " + receivedText);
          Intent intent = new Intent(Main.this, Math.class);
          intent.putExtra("inputText", getText());
          startActivity(intent);          
      }
  
      public CharSequence getText(){
          return receivedText;
      }
      }//end inner class
  } //end main
  </code></pre>
  
  <p>Aren't constructors always called if the arguments match the parameters? @_@</p>
  
  <p>Also, what I'm trying to accomplish is pass the text in the <code>EditText</code> view to a new intent.  </p>
  
  <p>I can do this by creating the <code>EditText</code> object in the <code>OnClick</code>, but I want to create it in the main method and then pass the information to the <code>OnClick</code>.  </p>
  
  <p>Thanks!</p>