i am trying to make a drawing application.
i want to draw a single-touch motion path in android - like the way the Swype keyboard does it.
And consequently i want to store x-y coordinates of EACH of the pixels of the motion path into a data structure.
How can i use the MotionEvent pointers to do this?
You probably don't have to store every pixel - just store a new one when certain parameters are met such as the pixel is further along or if the angle between one pixel and the next is greater than a certain threshold. From that you'll have a more compact poly line that will be easier to work with.
You should look how to handle touch events here : http://developer.android.com/guide/topics/ui/ui-events.html
The example in the documentation of MotionEvent ( http://developer.android.com/reference/android/view/MotionEvent.html ) shows you how to get the coordinates of the touch event motion.
Then all you have to do is draw it (and maybe smooth it up a little)
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