I am making my own Pattern Lock for android phone, i have Done the coding as when i click on an image it stores an integer in an array and when the user re-enters the same p
Implement onTouchEvent(MotionEvent ev)
, with ACTION_DOWN, ACTION_MOVE, ACTION_UP
. As your finger moving, draw a line from previous Coordinate to current Coordinate.
Get coordinate by using ev.getX()
ev.getY()
I've just thought of two solution currently:
ACTION_DOWN
, draw a transparent VIEW on top of parent view, make it Canvas and draw as long as ACTION_MOVE
is under processing.
SurfaceView
instead of regular View. A sample on SurfaceView to draw: http://www.droidnova.com/playing-with-graphics-in-android-part-ii,160.html