Event handling is basically just writing program logic in response to a user action. This program logic is written usually as part of Java methods. There are two ways you can handle events: you can do it either declaratively or programmatically. This chapter explores both ways.
Overview of Event Handling
- 1.
Define the view object (e.g., a Button view). This can be done in either design or text mode
<Buttonandroid:id="@+id/button"android:layout_width="wrap_content"android:layout_height="wrap_content" ...