Code example for GestureLibrary

Methods: recognize

0
		GestureOverlayView gesture = (GestureOverlayView) findViewById(R.id.gesture_view);
		gesture.addOnGesturePerformedListener(new GestureOverlayView.OnGesturePerformedListener() {
			@Override 
			public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
				Log.d(TAG, "gesture performed");
				ArrayList<Prediction> predictions = mLibrary.recognize(gesture);
				if (predictions.size() > 0) {
					Prediction prediction = predictions.get(0);
					if (prediction.score > 1.0) {
						Log.d(TAG, "predicated successfully (" + prediction.name + ")");
						Intent intent = new Intent();
						intent.putExtra("gesture", prediction.name);
						GestureActivity.this.setResult(RESULT_OK, intent);
					} 
					else { 
						Log.d(TAG, "there is no good predication");
						GestureActivity.this.setResult(RESULT_CANCELED);
					} 
				} 
				else { 
					Log.d(TAG, "there is no predication");