title: What are the different ways to implement a button in Android java?
body: <p>I know these two:</p>
  
  <ol>
  <li><p><code>Button b = (Button) (findViewById(R.id.Button2));</code></p></li>
  <li><p><code>android:onClick=""</code></p></li>
  </ol>
  
  <p>Are there any different ways?</p>
  
  <p>I just tried <code>Button b = new Button();</code></p>
  
  <p>But it did not work in android!</p>
  
  <p>Thank you!</p>