title: Add new Gestures programmatically
body: <p>I want to let the users of my app create new gestures for specific events. So the user shall be able to create new gestures, which are saved to a file. When the user draw the gesture a specific event shall be performed, which was declared before. </p>
  
  <p>I tried it with this code: </p>
  
  <pre><code>static File mStoreFile = new File ( Environment.getExternalStorageDirectory (), "gestures" );
  @Override
  protected void onCreate ( Bundle savedInstanceState ) {
      super.onCreate ( savedInstanceState );
      setContentView ( R.layout.neuegeste );
  
      name = this.getIntent ().getExtras ().getString ( "applikationsname" );
      Log.d("neueGeste", "neueGeste " + name);
  
     GestureOverlayView gestureView = ( GestureOverlayView ) findViewById ( R.id.
              gestureLayout );
  
      gestureView.addOnGestureListener ( new GesturesProcessor () );
  }
  </code></pre>
  
  <p>GesturesProcessor():</p>
  
  <pre><code>private class GesturesProcessor implements GestureOverlayView.OnGestureListener {
  
      @Override
      public void onGestureEnded ( GestureOverlayView overlay, MotionEvent event ) {
  
          String text;
          gesture = overlay.getGesture ();
          if ( gesture.getLength () &lt; LENGTH_THRESHOLD ) {
  
              text = "Geste war zu kurz";
              Dialog_Anzeigen2 ( text );
              overlay.clear ( false );
  
          }
  
          text = "Geste übernehmen?";
          Dialog_Anzeigen(text);
  
      }
  
      @Override
      public void onGestureCancelled ( GestureOverlayView overlay, MotionEvent event ) {
  
      }
  </code></pre>
  
  <p>And this for storing the new gesture in the file:</p>
  
  <pre><code> public void confirm() {
          if (gesture != null) {
  
              Log.d ( "hier", "hier " );
              GestureLibrary store = GestureLibraries.fromFile ( mStoreFile );
  
              store.addGesture(name, gesture);
              store.save();
  
              Set&lt;String&gt; entries = store.getGestureEntries();
              Log.d ( "entries1.size ()", "entries1.size() " + entries.size () );
  
              setResult ( RESULT_OK );
  
          } else {
              setResult(RESULT_CANCELED);
          }
      }
  
  }
  </code></pre>
  
  <p>The file is created without problems and I also think the new gesture is saved to file (the filesize of the file changes), but when I try to determine the amount of the gestures saved in file the result will be 0 or 1. </p>
  
  <p>Where are the failures or how do I check the amount of saved gestures correctly?</p>
  
  <p>I also want to draw the saved gestures, so that the user has got the possibility to show the created gestures. Is there any possibility to get the Drawables out of all created gestures of the file, to add them to an ImageView? </p>
  
  <p>Thanks a lot for helping. </p>