Example usage for android.view KeyEvent KEYCODE_BUTTON_L2

List of usage examples for android.view KeyEvent KEYCODE_BUTTON_L2

Introduction

In this page you can find the example usage for android.view KeyEvent KEYCODE_BUTTON_L2.

Prototype

int KEYCODE_BUTTON_L2

To view the source code for android.view KeyEvent KEYCODE_BUTTON_L2.

Click Source Link

Document

Key code constant: L2 Button key.

Usage

From source file:com.aengbee.android.leanback.ui.PlaybackOverlayActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BUTTON_R1) {
        getMediaController().getTransportControls().skipToNext();
        return true;
    } else if (keyCode == KeyEvent.KEYCODE_BUTTON_L1) {
        getMediaController().getTransportControls().skipToPrevious();
        return true;
    } else if (keyCode == KeyEvent.KEYCODE_BUTTON_L2) {
        getMediaController().getTransportControls().rewind();
    } else if (keyCode == KeyEvent.KEYCODE_BUTTON_R2) {
        getMediaController().getTransportControls().fastForward();
    }/*w w w .  j  a  va 2  s.c om*/

    return super.onKeyDown(keyCode, event);
}