Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save codeswimmer/900769 to your computer and use it in GitHub Desktop.
Save codeswimmer/900769 to your computer and use it in GitHub Desktop.
Android: covert the given MotionEvent.getAction() result into a String.
public static String eventActionToString(int eventAction) {
switch (eventAction) {
case MotionEvent.ACTION_CANCEL: return "Cancel";
case MotionEvent.ACTION_DOWN: return "Down";
case MotionEvent.ACTION_MOVE: return "Move";
case MotionEvent.ACTION_OUTSIDE: return "Outside";
case MotionEvent.ACTION_UP: return "Up";
case MotionEvent.ACTION_POINTER_DOWN: return "Pointer Down";
case MotionEvent.ACTION_POINTER_UP: return "Pointer Up";
}
return "";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment