Example usage for android.view MotionEvent actionToString

List of usage examples for android.view MotionEvent actionToString

Introduction

In this page you can find the example usage for android.view MotionEvent actionToString.

Prototype

public static String actionToString(int action) 

Source Link

Document

Returns a string that represents the symbolic name of the specified unmasked action such as "ACTION_DOWN", "ACTION_POINTER_DOWN(3)" or an equivalent numeric constant such as "35" if unknown.

Usage

From source file:org.gearvrf.weartouchpad.WearStatusActivity.java

private String getPrintableEvent(MotionEvent event) {
    StringBuilder builder = new StringBuilder();
    if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
        builder.append(MotionEvent.actionToString(event.getAction()));
    } else {/* w  ww.  j av  a 2s.  c o  m*/
        builder.append(event.getAction());
    }
    builder.append(", X=").append(String.format("%.2f", event.getX())).append(", Y=")
            .append(String.format("%.2f", event.getY()));
    return builder.toString();
}