There are very well answers here, but I want to add one line:
In android:onclick
in XML, Android uses java reflection behind the scene to handle this.
And as explained here, reflection always slows down the performance. (especially on Dalvik VM). Registering onClickListener
is a better way.