forum

home / developersection / forums / which is better way performance wise , andriod:onclick or set onclicklistener for android objects

Which is better way performance wise , andriod:onClick or set onClickListener for android objects

Anonymous User 1873 21-Jul-2015
Android docs mention two ways to set an onclick event on a button :
1.Using the android:onClick XML attribute where you just use the name of a public method with the signaturevoid name(View v) 
2. By using the setOnClickListener method where you pass an object that implement the OnClickListener interface. 

Which one is  correct ways ? Which is better techniques performance wise?

Please Expalin why

Updated on 22-Jul-2015

I am a content writter !

Can you answer this question?

Answer

1 Answers

Liked By