Events are the messages or notifications which are generated by controls such as buttons, checkbox, radio buttons etc. System responds to those messages or notifications by executing some code.
contains a single callback method. It is an interface in the View class.
is the method that handles the event. The Event Listener calls the Event Handlers.
is a process, where an Event Handler gets registered with an Event Listener. Event Handler is called when the Event Listener fires the event.
Event Handler | Event Listener | Description |
---|
onClick() | OnClickListener() | Called when the user either clicks or touches any widget like button, images, text etc. |
onLongClick() | OnLongClickListener() | Called when the user either clicks or touches any widget like button, text, image etc. for one or more seconds. |
onFocusChange() | OnFocusChangeListener() | Called when the widget looses its focus that means the user goes away from the view point. |
onKey() | OnFocusChangeListener() | Called when the user is focused on the item and presses or releases a key on the device. |
onTouch() | OnTouchListener() | Called when the user presses or releases the key. |
onMenuItemClick() | OnMenuItemClickListener() | Called when the user selects a menu item. |
OnCreateContextMenu() | OnCreateContextMenuITemListener() | Called when the context menu is being built. |