Like many GUI systems, Android is event based. User interaction with a view in an activity may trigger an event and you can write code that gets executed when the event occurs. The class that contains code to respond to a certain event is called an event listener.
In this chapter you will learn how to handle events and write event listeners.
Most Android programs are interactive. The user can interact with the application easily thanks to the event-driven programming paradigm the Android framework offers. Examples of events that may occur when the user is interacting with an activity are click, long-click, touch, key, and so on.
To make a program respond to a certain event, you need to write a listener ...