MotionEvent

Multitouch and gesture detection part 2

SDK Version: 
M3

In my previous article I showed how to create a simple class that handles the basic gesture events such as ACTION_DOWN, ACTION_MOVE, ACTION_POINTER_DOWN, ACTION_POINTER_UP, ACTION_UP. Combinations of these, you can implement all of touch gesture stuffs thats you need in your work with a touch screen phone.

Handling multitouch
Create a boolean member variable in your MultitouchView class that stores the actual multitouch event. Name it isMultiTouch.

  1. public class MultitouchView extends View {
  2.         private boolean isMultiTouch = false;
  3.  {...}

Multitouch and gesture detection part 1

SDK Version: 
M3

In this little tutorial I’m going to show you how to detect multitouch event on an Activity screen.

First of all let’s create a class next to the Main activity that called MultitouchView. It extends View:

  1. public class MultitouchView extends View {
  2.  
  3.  
  4.  
  5.         public MultitouchView(Context context) {
  6.                 super(context);
  7.  
  8.         }
  9.  
  10. }

Custom View - HorizontalSlider

SDK Version: 
M5

In this tutorial we'll create a custom View called HorizontalSlider based on ProgressBar. This slider will allow the user to move the slider back and forth on the screen and get notified when this happens.

Syndicate content