March 2016
Intermediate to advanced
428 pages
9h 2m
English
Almost every application needs to recognize and respond to basic events such as clicks and long-presses. It's so basic, in most of the recipes, we use the XML onClick attribute, but the more advanced listeners require setting up through code.
Android provides an Event Listener interface for receiving a single notification when certain actions occur, as shown in the following list:
onClick(): It's called when a View is pressedonLongClick(): It's called when the View is long-pressedonFocusChange(): It's called when the user navigates to or from the ViewonKey(): It's called when a hardware key is pressed or releasedonTouch(): It's called when a touch event occursThis recipe will demonstrate responding to the ...
Read now
Unlock full access