Header Ads

Event Listener

 An event listener is an interface in the View class that contains a single callback method
• These methods will be called by the Android framework when the View to which the listener has been registered is triggered by user interaction with the item in the UI.

Event listener interfaces and the callback methods:
 • onClick() From View.OnClickListener.   This is called when the user either touches the item (when in touch mode), or focuses upon the item with the navigationkeys or trackball and presses the suitable "enter" key or presses down on the trackball.
• onLongClick() From View.OnLongClickListener.   This is called when the user either touches and holds the item (when in touch mode), or focuses upon the item with the navigation-keys or trackball and presses and holds the suitable "enter" key or presses and holds down on the trackball (for one second).
 • onFocusChange() From View.OnFocusChangeListener.   This is called when the user navigates onto or away from the item, using the navigation-keys or trackball. 

• onKey() From View.OnKeyListener.   This is called when the user is focused on the item and presses or releases a hardware key on the device.
• onTouch() From View.OnTouchListener       This is called when the user performs an action qualified as a touch event, including a press, a release, or any movement gesture on the screen (within the bounds of the item).
 • onCreateContextMenu() From View.OnCreateContextMenuListener      This is called when a Context Menu is being built (as the result of a sustained "long click"). See the discussion on context menus in the Menus developer guide.

No comments

Powered by Blogger.