I am implementing Online Handwriting Recognition as my BE Project. I have created a class that extends Fragments. The fragment class contains two buttons and a GestureOverlayView. I have made its strokeType to be MULTIPLE.
I want to extract x and y coordinates of the strokes. But cannot find a way.... I have only created an instance of the GestureOverlayView as
package com.example.enotebook;
import java.util.ArrayList;
import android.gesture.GestureOverlayView;
import android.gesture.GestureOverlayView.OnGestureListener;
import android.gesture.GesturePoint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
public class WArea extends Fragment implements OnGestureListener {
private ArrayList<GesturePoint> gpoint;
private int count;
private Button b;
private TextView text;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View wView = inflater.inflate(R.layout.fragment_writing, container, false);
b = (Button) wView.findViewById(R.id.done);
//Creating TextView Variable
text = (TextView) wView.findViewById(R.id.textView1);
return wView;
}
@Override
public void onGesture(GestureOverlayView gesture, MotionEvent event) {
gpoint = gesture.getCurrentStroke();
count = gpoint.size();
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Sets the new text to TextView (runtime click event)
text.setText("You Have click the button -"+count);
}
});
}
@Override
public void onGestureCancelled(GestureOverlayView gesture, MotionEvent event) {
gpoint = gesture.getCurrentStroke();
count = gpoint.size();
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Sets the new text to TextView (runtime click event)
text.setText("You Have click the button -"+count);
}
});
}
@Override
public void onGestureEnded(GestureOverlayView gesture, MotionEvent event) {
gpoint = gesture.getCurrentStroke();
count = gpoint.size();
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Sets the new text to TextView (runtime click event)
text.setText("You Have click the button -"+count);
}
});
}
@Override
public void onGestureStarted(GestureOverlayView gesture, MotionEvent event) {
gpoint = gesture.getCurrentStroke();
count = gpoint.size();
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Sets the new text to TextView (runtime click event)
text.setText("You Have click the button -"+count);
}
});
}
}
I am new to android and java.....
Please Help...