Gesture Recognition In Android
Asked Answered
P

1

10

I'm new to Android and I'm working on Gestures. I have a problem regarding how to recognise the text. When a user draws a letter or number that has to be recognised and has to be printed on the top of the screen. I came to know that it can be done through GestureOverlayViewbut dont know how to implement it.

Can anyone please help me with some sample code.

Pretrice answered 7/6, 2011 at 6:20 Comment(0)
W
3

You can these two links which will be helpful

GestureOverlay

GestureOverlayView

Use this

public class YourClass extends Activity implements OnGesturePerformedListener {  
  private GestureLibrary mLibrary;   
mLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);  
 if (!mLibrary.load()) {     
    finish();   
  }     
 GestureOverlayView gestures =    (GestureOverlayView)findViewById(R.id.gestures);
     gestures.addOnGesturePerformedListener(this);  
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {  
   ArrayList<Prediction> predictions = mLibrary.recognize(gesture); 
    Log.v("performed","performed");  
   // We want at least one prediction  
   if (predictions.size() > 0) {    
     Prediction prediction = predictions.get(0);   
      // We want at least some confidence in the result   
      if (prediction.score > 1.0) {        
                 if(prediction.name.equalsIgnorecase("right")){    
                       //do you thing here//       
                } 
Windsail answered 7/6, 2011 at 6:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.