开发者

How to get gesture IDs and link to images in an array

Is there anyway to get a list of gesture ids, from the gesture library that has been created using gesturebuilder, then link them to images that are stored in an array. The images are used added to the gesture overlay view, so that be displayed.

I want to link each gesture to an images, so some sort of an id or name is needed. I have looked at the samples and other online material avaialbe for gestures, and there is no information on this matter.

Any help in this matter would be appreciated.

Example:

//Link the images to the gesture ids, so when a user draws an "a", 
//it is linked to the gesture "a"   
if (sStore.load())
{

      for (String name : sStore.getGestureEntries())
    {  
       //Stores the gesture and its name into Gesture gesture
   for (Gesture gesture : sStore.getGestures(name))
   {
      gesture.getID();
          //link IDs to image_array[i]

       }
    }
}


//match the image and the gesture, after a touch event.
if (predictions.size() > 0)
{
 Prediction prediction = predictions.get(0); 
 if(prediction.score > 1.0) 
 {
        if(prediction.best_score == Current_Image)
开发者_如何学JAVA        {
            Correct();
            Next_image();
        }
    }
}


GestureLibrary store = GestureLibraries.fromFile("/the/gesture/file");
if (store.load()){
    for (String name : store.getGestureEntries()){
        // access each gesture name/id
    }
}

Funny thing is that the complete example of how to do this kind of things is inside the samples directory of your Android SDK.


If you create seperate gesture libraries for each gesture, then each library can be put into an array. This array of gestures libraries, can be matched by its index, with an array of images. When selecting an image, make sure that the corresponding gesture library is loaded.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜