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 GestureOverlayView
but dont know how to implement it.
Can anyone please help me with some sample code.
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//
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With