Example usage for android.view SoundEffectConstants NAVIGATION_LEFT

List of usage examples for android.view SoundEffectConstants NAVIGATION_LEFT

Introduction

In this page you can find the example usage for android.view SoundEffectConstants NAVIGATION_LEFT.

Prototype

int NAVIGATION_LEFT

To view the source code for android.view SoundEffectConstants NAVIGATION_LEFT.

Click Source Link

Usage

From source file:android.widget.Gallery.java

/**
 * Handles left, right, and clicking//from w w  w  . j a  v a 2 s. c  o m
 * @see android.view.View#onKeyDown
 */
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {

    case KeyEvent.KEYCODE_DPAD_LEFT:
        if (movePrevious()) {
            playSoundEffect(SoundEffectConstants.NAVIGATION_LEFT);
            return true;
        }
        break;
    case KeyEvent.KEYCODE_DPAD_RIGHT:
        if (moveNext()) {
            playSoundEffect(SoundEffectConstants.NAVIGATION_RIGHT);
            return true;
        }
        break;
    case KeyEvent.KEYCODE_DPAD_CENTER:
    case KeyEvent.KEYCODE_ENTER:
        mReceivedInvokeKeyDown = true;
        // fallthrough to default handling
    }

    return super.onKeyDown(keyCode, event);
}