Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gesture Recognition In Android

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.

like image 550
Lavanya Avatar asked Jun 07 '11 06:06

Lavanya


1 Answers

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//       
                } 
like image 199
Stuti Avatar answered Sep 30 '22 20:09

Stuti