Develop Apps for Android

Android App Development – Classifying touchscreen movements?

12/03/2013 11:44

Question by :  –  Android App Development Classifying touchscreen movements?
I’ve been working through some tutorials on Android App Development, and I’ve realized it seems that they won’t be telling me how to do something it is crucial for the app that I am planning to develop.

What I’m wanting is for my app to have a blank spot (probably a MyView or something) in which the user will draw a shape with their finger (either a vertical line, a horizontal line, an up-left to down-right slash, or a down-left to up-right slash.) All my program needs to do is decide if the line drawn is horizontal, vertical, etc. by comparing the coordinates of the startpoints of the drawn line and the endpoints or something like that. Can someone please refer me to a tutorial or something that will help me?

Thanks,
Let me be more specific:

What I’m looking for is a function that will allow me to determine the coordinates of the starting point of any line drawn in the MyView as well as the endpoint.

public boolean onTouchEvent(MotionEvent event) {

}

this is how, then make an if that is somthing like event.ACTION_DRAG_START then set the x1 and y1 and then if event.ACTION_DRAG_STOP then set x2 and y2

Search site

Contact

Android Development