Example usage for android.view Window superDispatchKeyEvent

List of usage examples for android.view Window superDispatchKeyEvent

Introduction

In this page you can find the example usage for android.view Window superDispatchKeyEvent.

Prototype

public abstract boolean superDispatchKeyEvent(KeyEvent event);

Source Link

Document

Used by custom windows, such as Dialog, to pass the key press event further down the view hierarchy.

Usage

From source file:android.app.Activity.java

/**
 * Called to process key events.  You can override this to intercept all 
 * key events before they are dispatched to the window.  Be sure to call 
 * this implementation for key events that should be handled normally.
 * /*  w  w  w  . j a va 2 s.  c  om*/
 * @param event The key event.
 * 
 * @return boolean Return true if this event was consumed.
 */
public boolean dispatchKeyEvent(KeyEvent event) {
    onUserInteraction();
    Window win = getWindow();
    if (win.superDispatchKeyEvent(event)) {
        return true;
    }
    View decor = mDecor;
    if (decor == null)
        decor = win.getDecorView();
    return event.dispatch(this, decor != null ? decor.getKeyDispatcherState() : null, this);
}