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.MotionEvent; public class Main { /** * Gets the name of an action. * * @param action The action being performed. * @param isMotionEvent Whether or not the action is a motion event. * * @return The name of the action being performed. */ public static String getActionName(int action, boolean isMotionEvent) { switch (action) { case MotionEvent.ACTION_DOWN: return "DOWN"; case MotionEvent.ACTION_UP: return "UP"; case MotionEvent.ACTION_MOVE: return isMotionEvent ? "MOVE" : "MULTIPLE"; case MotionEvent.ACTION_CANCEL: return "CANCEL"; case MotionEvent.ACTION_OUTSIDE: return "OUTSIDE"; case MotionEvent.ACTION_POINTER_DOWN: return "POINTER_DOWN"; case MotionEvent.ACTION_POINTER_UP: return "POINTER_UP"; case MotionEvent.ACTION_HOVER_MOVE: return "HOVER_MOVE"; case MotionEvent.ACTION_SCROLL: return "SCROLL"; case MotionEvent.ACTION_HOVER_ENTER: return "HOVER_ENTER"; case MotionEvent.ACTION_HOVER_EXIT: return "HOVER_EXIT"; default: return "ACTION_" + Integer.toString(action); } } }