O'Reilly logo

Android Studio Essentials by Belén Cruz Zapata

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling events

The user interface would be useless if the rest of the application could not interact with it. Events in Android are generated when the user interacts with our application. All the UI widgets are children of the View class, and they share some events handled by the following listeners:

  • OnClickListener: This captures the event when the user clicks on the view element
  • OnCreateContextMenu: This captures the event when the user performs a long click on the view element and we want to open a context menu
  • OnDragListener: This captures the event when the user drags and drops the event element
  • OnFocusChange: This captures the event when the user navigates from one element to another in the same view
  • OnKeyListener: This captures the event when ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required