Java tutorial
//package com.java2s; /**************************************************************************** * * * Project64 - A Nintendo 64 emulator. * * http://www.pj64-emu.com/ * * Copyright (C) 2012 Project64. All rights reserved. * * * * License: * * GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html * * * ****************************************************************************/ import android.view.InputDevice; public class Main { /** * Gets the name of the source performing an action. * * @param source A number representing the source. * * @return The name of the source. */ public static String getSourceName(int source) { switch (source) { case InputDevice.SOURCE_CLASS_BUTTON: return "BUTTON"; case InputDevice.SOURCE_CLASS_POINTER: return "POINTER"; case InputDevice.SOURCE_CLASS_TRACKBALL: return "TRACKBALL"; case InputDevice.SOURCE_CLASS_POSITION: return "POSITION"; case InputDevice.SOURCE_CLASS_JOYSTICK: return "JOYSTICK"; case InputDevice.SOURCE_DPAD: return "dpad"; case InputDevice.SOURCE_GAMEPAD: return "gamepad"; case InputDevice.SOURCE_JOYSTICK: return "joystick"; case InputDevice.SOURCE_KEYBOARD: return "keyboard"; case InputDevice.SOURCE_MOUSE: return "mouse"; case InputDevice.SOURCE_STYLUS: return "stylus"; case InputDevice.SOURCE_TOUCHPAD: return "touchpad"; case InputDevice.SOURCE_TOUCHSCREEN: return "touchscreen"; case InputDevice.SOURCE_TRACKBALL: return "trackball"; case InputDevice.SOURCE_UNKNOWN: return "unknown"; default: return "source_" + source; } } }