2

I am developing an application which will take gestures and convert those gestures to according text and store them in database. I want to know if there is any Android API or method for this task.

Suhaib Janjua
  • 3,538
  • 16
  • 59
  • 73
user3091531
  • 107
  • 1
  • 8

1 Answers1

1

You can use a GestureDetector that generates String when a gesture is detected.

For example use OnGestureListener callbacks :

// From inside some Context (View, Activity, ...)
GestureDectector detector = new GestureDetector(this, new OnGestureListener() {

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
        gestureDetected("FLING"); // 'gestureDetected' is then a callback to invoke on 'conversion of a gesture into a string'
    }
});

Then MotionEvent have to be 'forwarded' to the GestureDetector, for example by overriding View.onTouchEvent(MotionEvent) :

public boolean onTouchEvent(MotionEvent event) {
    return detector.onTouchEvent(event);
}
Antoine Marques
  • 1,379
  • 1
  • 8
  • 16