title: How to display gestures from the library as a bitmap?
body: <p>I need to display the gesture library as a bitmap images. The code below is what I have, however it doesnt seem to work. I am getting an error on Logcat every time I run the program. </p>
  
  <pre><code>sStore = GestureLibraries.fromRawResource(this, R.raw.gestures_alph);
      int i = 0;
      for (String name : sStore.getGestureEntries())
      {  
              for (Gesture gesture : sStore.getGestures(name))
              {
                  Bitmap bitmap = gesture.toBitmap(mThumbnailSize, mThumbnailSize, mThumbnailInset, mPathColor);
                  theList.add(i,bitmap);
                  i++;
              }
      }
  
      int rand = (int)(Math.random()*theList.size());
      Bitmap element = theList.get(rand);
      imagetemp.setImageBitmap(element);
      gestures.addView(imagetemp);
  
  }
  </code></pre>
  
  <p>The error I get is shown below, It says that there is nothing in the arraylist, so it is probably the for loop.</p>
  
  <p><strong>ERROR/AndroidRuntime(8258): Uncaught handler: thread main exiting due to uncaught exception 
  ERROR/AndroidRuntime(8258): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.menu.sample/com.menu.sample.ImageTest}: java.lang.IndexOutOfBoundsException: Invalid location 0, size is 0
  java.util.ArrayList.get(ArrayList.java:341)</strong></p>
  
  <p><strong>Error Fixed</strong>
  The Library had to be loaded first. </p>
  
  <pre><code>if (sStore.load()){
       for (String name : sStore.getGestureEntries())      {
           for (Gesture gesture : sStore.getGestures(name))
  
                  {
  </code></pre>