Bind method to a button in android
<p>I have a button in my layout with the following attribute: android:onClick="nextQ" and in my java code the following method:  </p>

<pre><code>public int nextQ()
{
    // do stuff here
    return answer;
}  
</code></pre>

<p>Where answer is an integer. Whenever the button is clicked the application closes. Any idea why it breaks?</p>
