title: How to use android:onClick?
body: <p>I'm new to android programming. How do you use android:onClick? Where do I put the method I want to call?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
  &lt;Button
          android:id="@+id/button1"
          android:layout_width="wrap_content"
          android:layout_height="0dp"
          android:layout_weight="1"
          android:text="Button"
          android:onClick="doSomething"/&gt;
  &lt;ImageView
      android:id="@+id/icon"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_weight="1"
      android:adjustViewBounds="true"
      android:src="@drawable/molecule" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>Would I put it in the .java file that calls for this layout to be made?</p>