Any downside of using android: onClick?

What works best for implementing onClick methods: - Using android: onClick attribute in xml - Implementing and defining onClickListener?

+3
source share
7 answers

In my opinion, the definition of implementation and the definition is OnClickListenermuch better. The main reason is that it’s easier for others to understand how the code works.

When you read the application code for Android, you will read .java files (90% of the time) to understand how this works; You’ll ignore most XML layouts that don’t tell you how the application really works or what its purpose is.

, android:onClick, ( ) : XML- Java, , .

, ; , .

+3

onClick XML, , , , XML.

+1

android: onClick, Java , switch findViewById. , android: onClick, .

0

minSdkVersion 4 (1.6) , android: onClick. . minSdkVersion 4 (, 3, 1,5), onClick, .

onClick OnClickListener, . , .

0

XML onClick . , , , onClick. , XML, onclicks, , , , .

:

http://blog.blundell-apps.com/using-annotations-for-android-xml-onclick-visibility/

:

 @FromXML
 public void onSomeXmlButtonClick(View button){

 }
0

Is this explanation of the onclick event (HTML / ASP) somehow applicable to the Android world?

http://spicr.net/jnit/?p=13

-2
source

Source: https://habr.com/ru/post/1782924/


All Articles