Design + Code an Android App from Scratch
Scrounge up some loose change to become a pro member, or login to your account to view this lesson.
Alright, join now. Or login to your account if you're already a pro member.This video talks about the MotionEvent and Touch event in Android. It first illustrates the different types of gestures in Android such as tap, double tap, drag, flick, pinch, spread, press, press and tap, press and drag, and rotate. Then we discuss the 4 main types of events, ACTION_DOWN which is triggered when you put your finger on the screen, ACTION_MOVE which is triggered when you hold your finger down on the screen and move around, ACTION_UP which is triggered when you lift your finger off the screen, ACTION_CANCEL which is triggered when Android takes control of the event from you. In the next round, we discuss pointers and multitouch in Android with the help of ACTION_POINTER_DOWN and ACTION_POINTER_UP. We also cover the coordinates of a MotionEvent which can be obtained with the help of getX, getY or getRawX, getRawY and illustrate the difference between them.