Android multi-touch is essentially supported by LCD drivers and programming. Currently, many well-known manufacturers such as HTC, Motorola, and Samsung can support multi-touch Multitouch technology as long as they use capacitive screen touch principles, provides a better user experience for webpage scaling and gesture operations. On the Android platform, events are processed using the MotionEvent object method. For example, when a touch is started, ACTION_DOWN is triggered, and ACTION_UP is triggered when ACTION_MOVE finally releases the finger. Of course, user-less operations may trigger the ACTION_CANCEL action.
First of all, we would like to remind you that multi-touch operations can only be achieved through LCD driver and application software, for example, mobile phones that were previously Android 2.1 or listed in North America may not support multi-touch firmware, due to Apple's patent, new firmware models after Android 2.1 in Europe and Asia Pacific have been supported in screen drivers, and the simulator cannot perform multi-touch testing.
In the following example, Android123 uses the Android 2.0 or later SDK to implement multi-touch operations through the application layer. For general control touch operations, the setOnTouchListener () of the View is used internally () the onTouchEvent () method implemented by the interface. For the parameter MotionEvent of the onTouchEvent method, we can process it in detail to understand the multi-touch method. For example
Event. getAction () // obtain touch actions such as ACTION_DOWN
Event. getPointerCount (); // obtain the number of touch points. For example, if 2 is used, two fingers may simultaneously press the screen.
Event. getPointerId (nID); // For the details of each touch point, we can obtain the index by executing the getPointerId method in a loop.
Event. getX (nID); // obtain the x position of the nID touch point
Event. getY (nID); // obtain the y position of the nID point.
Event. getPressure (nID); // LCD can sense the user's finger pressure. Of course, the specific level is determined by the driver and physical hardware.
Event. getDownTime () // Press Start Time
Event. getEventTime () // event end time
Event. getEventTime ()-event. getDownTime (); // it takes a long time to press
More detailed technologies related to Android multi-touch will be discussed in detail in future due to current compatibility and firmware issues. Here we will give you a shot.