I learn from
http://developer.android.com/reference/android/widget/Button.html
that \"instead of applying an OnClickListener to the button
I've explained the different ways you can implement an OnClickListener on my blog: http://www.androiddevresources.com/guides/tutorial-how-to-implement-an-onclicklistener/
Basically there are three ways. - Implement the listener in the activity class (and set the xml attribute) - Create a variable in your activity class (or other class, for example a fragment). - Create a new listener in line with new OnClickListener().
I've added example code in the article and an example project on GitHub which you can download.