0

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...

  • Google is your best friend. also see this link may help you :)http://stackoverflow.com/questions/12637911/a-simple-drawing-example – Ali Imran Mar 14 '14 at 09:13
  • See my answer http://stackoverflow.com/questions/21846584/android-canvas-draw-by-finger-solved-example/21846585#21846585 This link may help yew.. :) – Namrata Mar 14 '14 at 09:39
  • I tried changing codes, but it does not work :( I want it soon. Please Help..... – user3419086 Mar 18 '14 at 12:51

0 Answers0