Android Gestures

March 21st, 2010 by

Since version 1.6 Android offers a library for recognition and handling of new gestures using a touch display. With the gesture builder it is possible to capture new gestures in the emulator. Gestures can be integrated into an activity like that:

GestureLibrary gLib = GestureLibraries.fromRawResource(this, R.raw.spells);
if (!gLib.load()) {
  • Furthermore we need a gesture overlay in the UI:
 android:layout_weight="1.0" /
GestureOverlayView gestures = (GestureOverlayView) findViewById(;
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
 ArrayList<prediction> predictions = mLibrary.recognize(gesture);
   if (predictions.size() > 0) {
     Prediction prediction = predictions.get(0);
     if (prediction.score > 1.0) {
       Toast.makeText(this,, Toast.LENGTH_SHORT).show();

*Update* : In Android 2.2 there is a new class GestureUtils providing some new methods for feature extraction, geometric transformation and gesture similarity comparison – for more information take a look at the class docs.

*Update* : I have written a tutorial for creating a sample app recognizing getures – take a look here.

More information

Tags: , , , , , ,

Leave a Reply

Please leave these two fields as-is:

Protected by Invisible Defender. Showed 403 to 122,030 bad guys.