Question

I need to create some customs gesture to enable some particular settings on my app.

For example I need to create a L gesture like in the photo

enter image description here

There's a way to save gesture and then retrive when one of them are performed?

Was it helpful?

Solution

There is an app installed on emulators called GestureBuilder, which allows you to save and record custom Gestures. If you don't want to run it in your emulator, you can also find it in the included SDK documents, just import it and run it on your device. See this article for more information.

Once you have the saved gesture file, then you need to copy the saved gesture file to your /res/raw folder, load it, and attach a gesture listener, as is done in this article:

gestureLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
     gestureLibrary.load();
 OnGesturePerformedListener gesturePerformedListener
 = new OnGesturePerformedListener(){

 @Override
 public void onGesturePerformed(GestureOverlayView view, Gesture gesture) {
  // TODO Auto-generated method stub
  ArrayList<Prediction> prediction = gestureLibrary.recognize(gesture);
  if(prediction.size() > 0){
   gestureResult.setText(prediction.get(0).name);
  }

 }};
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top