Users Pricing

forum

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

Anonymous User 2060 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

I am a content writter !


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md