The syntax for triggering a function whenever a button is hit is usually
What I notice is that the function triggered always has a parameter
(View view), yet in the syntax above I don't see any thing passed into it. Could someone explain this to me?
Best How To :
The parameters view in this case is the button that is clicked
Android UI Events
Within the various View classes that you'll use to compose your layout, you may notice several public callback methods that look useful for UI events. These methods are called by the Android framework when the respective action occurs on that object. For instance, when a View (such as a Button) is touched, the onTouchEvent() method is called on that object. However, in order to intercept this, you must extend the class and override the method. However, extending every View object in order to handle such an event would not be practical. This is why the View class also contains a collection of nested interfaces with callbacks that you can much more easily define. These interfaces, called event listeners, are your ticket to capturing the user interaction with your UI.