Example usage for android.view MotionEvent getPointerCount

List of usage examples for android.view MotionEvent getPointerCount

Introduction

In this page you can find the example usage for android.view MotionEvent getPointerCount.

Prototype

public final int getPointerCount() 

Source Link

Document

The number of pointers of data contained in this event.

Usage

From source file:de.dmxcontrol.activity.ControlActivity.java

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
    if (!isPointInsideView(event.getX(), event.getY(),
            fManager.findFragmentById(R.id.action_fragment).getView())) {
        if (event.getPointerCount() == 2 && oldState == ActionSelectorFragment.STATE_OPTIC_PANEL) {
            return super.dispatchTouchEvent(event);
        } else {/*from   w ww . ja  v  a 2s  .  c o  m*/

            gestureDetector.onTouchEvent(event);
        }
        switch (oldState) {
        case ActionSelectorFragment.STATE_INTENSITY_PANEL:
        case ActionSelectorFragment.STATE_COLOR_PANEL:
        case ActionSelectorFragment.STATE_PANTILT_PANEL:
            if (!(event.getAction() == MotionEvent.ACTION_MOVE) || event.getEventTime()
                    - event.getDownTime() > this.getResources().getInteger(R.integer.touch_gesture_delay)) {
                return super.dispatchTouchEvent(event);
            }
            return false;
        default:
            return super.dispatchTouchEvent(event);
        }
    }
    return super.dispatchTouchEvent(event);
}

From source file:ca.frozen.rpicameraviewer.activities.VideoFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_video, container, false);

    // configure the name
    nameView = (TextView) view.findViewById(R.id.video_name);
    nameView.setText(camera.name);//from ww w  . j  ava  2 s .  c om

    // initialize the message
    messageView = (TextView) view.findViewById(R.id.video_message);
    messageView.setTextColor(App.getClr(R.color.good_text));
    messageView.setText(R.string.initializing_video);

    // set the texture listener
    textureView = (ZoomPanTextureView) view.findViewById(R.id.video_surface);
    textureView.setSurfaceTextureListener(this);
    textureView.setZoomRange(MIN_ZOOM, MAX_ZOOM);
    textureView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent e) {
            switch (e.getAction()) {
            case MotionEvent.ACTION_DOWN:
                stopFadeOutTimer();
                break;
            case MotionEvent.ACTION_UP:
                if (e.getPointerCount() == 1) {
                    startFadeOutTimer(false);
                }
                break;
            }
            return false;
        }
    });

    // create the snapshot button
    snapshotButton = (Button) view.findViewById(R.id.video_snapshot);
    snapshotButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            int check = ContextCompat.checkSelfPermission(getActivity(),
                    Manifest.permission.WRITE_EXTERNAL_STORAGE);
            if (check != PackageManager.PERMISSION_GRANTED) {
                ActivityCompat.requestPermissions(getActivity(),
                        new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE },
                        REQUEST_WRITE_EXTERNAL_STORAGE);
            } else {
                takeSnapshot();
            }
        }
    });

    // move the snapshot button over to account for the navigation bar
    if (fullScreen) {
        float scale = getContext().getResources().getDisplayMetrics().density;
        int margin = (int) (5 * scale + 0.5f);
        int extra = Utils.getNavigationBarHeight(getContext(), Configuration.ORIENTATION_LANDSCAPE);
        ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) snapshotButton.getLayoutParams();
        lp.setMargins(margin, margin, margin + extra, margin);
    }

    return view;
}

From source file:org.uoyabause.android.PadButton.java

public boolean onTouch(View v, MotionEvent event) {

    int action = event.getActionMasked();
    int touchCount = event.getPointerCount();

    int pointerIndex = event.getActionIndex();
    int pointerId = event.getPointerId(pointerIndex);
    int posx = (int) event.getX(pointerIndex);
    int posy = (int) event.getY(pointerIndex);

    float hitsize = 15.0f * wscale * base_scale;
    RectF hittest = new RectF((int) (posx - hitsize), (int) (posy - hitsize), (int) (posx + hitsize),
            (int) (posy + hitsize));

    switch (action) {
    case MotionEvent.ACTION_DOWN:
        for (int btnindex = 0; btnindex < PadEvent.BUTTON_LAST; btnindex++) {
            if (buttons[btnindex].intersects(hittest)) {
                buttons[btnindex].On(pointerId);
            }/*  w  w w .j  av  a 2  s  .  c o m*/
        }

        if (_pad_mode == 1) {
            updatePad(hittest, posx, posy, pointerId);
        }

        break;

    case MotionEvent.ACTION_POINTER_DOWN:
        for (int btnindex = 0; btnindex < PadEvent.BUTTON_LAST; btnindex++) {
            if (buttons[btnindex].intersects(hittest)) {
                buttons[btnindex].On(pointerId);
            }
        }
        if (_pad_mode == 1) {
            updatePad(hittest, posx, posy, pointerId);
        }

        break;

    case MotionEvent.ACTION_POINTER_UP:
        for (int btnindex = 0; btnindex < PadEvent.BUTTON_LAST; btnindex++) {
            if (buttons[btnindex].intersects(hittest)) {
                buttons[btnindex].Off();
            }
        }

        if (_pad_mode == 1) {
            releasePad(pointerId);
        }

        break;

    case MotionEvent.ACTION_CANCEL:
    case MotionEvent.ACTION_UP:
        for (int btnindex = 0; btnindex < PadEvent.BUTTON_LAST; btnindex++) {
            if (buttons[btnindex].intersects(hittest)) {
                buttons[btnindex].Off();
            }
        }

        if (_pad_mode == 1) {
            releasePad(pointerId);
        }

        break;

    case MotionEvent.ACTION_MOVE:

        for (int index = 0; index < touchCount; index++) {

            int eventID2 = event.getPointerId(index);
            float x2 = event.getX(index);
            float y2 = event.getY(index);

            RectF hittest2 = new RectF((int) (x2 - hitsize), (int) (y2 - hitsize), (int) (x2 + hitsize),
                    (int) (y2 + hitsize));

            for (int btnindex = 0; btnindex < PadEvent.BUTTON_LAST; btnindex++) {
                if (eventID2 == buttons[btnindex].getPointId()) {
                    if (buttons[btnindex].intersects(hittest2) == false) {
                        buttons[btnindex].Off();
                    }
                } else if (buttons[btnindex].intersects(hittest2)) {
                    buttons[btnindex].On(eventID2);
                }
            }

            if (_pad_mode == 1) {
                updatePad(hittest2, (int) x2, (int) y2, eventID2);
            }
        }
        break;
    }

    if (!testmode) {

        if (_pad_mode == 0) {

            for (int btnindex = 0; btnindex < PadEvent.BUTTON_LAST; btnindex++) {
                if (buttons[btnindex].isOn()) {
                    YabauseRunnable.press(btnindex, 0);
                } else {
                    YabauseRunnable.release(btnindex, 0);
                }
            }
        } else {
            for (int btnindex = PadEvent.BUTTON_RIGHT_TRIGGER; btnindex < PadEvent.BUTTON_LAST; btnindex++) {
                if (buttons[btnindex].isOn()) {
                    YabauseRunnable.press(btnindex, 0);
                } else {
                    YabauseRunnable.release(btnindex, 0);
                }
            }
        }
    }

    if (testmode) {
        status = "";
        status += "START:";
        if (buttons[PadEvent.BUTTON_START].isOn())
            status += "ON ";
        else
            status += "OFF ";

        status += "\nUP:";
        if (buttons[PadEvent.BUTTON_UP].isOn())
            status += "ON ";
        else
            status += "OFF ";
        status += "DOWN:";
        if (buttons[PadEvent.BUTTON_DOWN].isOn())
            status += "ON ";
        else
            status += "OFF ";
        status += "LEFT:";
        if (buttons[PadEvent.BUTTON_LEFT].isOn())
            status += "ON ";
        else
            status += "OFF ";
        status += "RIGHT:";
        if (buttons[PadEvent.BUTTON_RIGHT].isOn())
            status += "ON ";
        else
            status += "OFF ";

        status += "\nA:";
        if (buttons[PadEvent.BUTTON_A].isOn())
            status += "ON ";
        else
            status += "OFF ";
        status += "B:";
        if (buttons[PadEvent.BUTTON_B].isOn())
            status += "ON ";
        else
            status += "OFF ";
        status += "C:";
        if (buttons[PadEvent.BUTTON_C].isOn())
            status += "ON ";
        else
            status += "OFF ";

        status += "\nX:";
        if (buttons[PadEvent.BUTTON_X].isOn())
            status += "ON ";
        else
            status += "OFF ";
        status += "Y:";
        if (buttons[PadEvent.BUTTON_Y].isOn())
            status += "ON ";
        else
            status += "OFF ";
        status += "Z:";
        if (buttons[PadEvent.BUTTON_Z].isOn())
            status += "ON ";
        else
            status += "OFF ";

        status += "\nLT:";
        if (buttons[PadEvent.BUTTON_LEFT_TRIGGER].isOn())
            status += "ON ";
        else
            status += "OFF ";
        status += "RT:";
        if (buttons[PadEvent.BUTTON_RIGHT_TRIGGER].isOn())
            status += "ON ";
        else
            status += "OFF ";

        status += "\nAX:";
        if (_analog_pad.isOn())
            status += "ON " + _axi_x;
        else
            status += "OFF " + _axi_x;
        status += "AY:";
        if (_analog_pad.isOn())
            status += "ON " + _axi_y;
        else
            status += "OFF " + _axi_y;

    }
    if ((listener != null)) {
        listener.onPad(null);
    }
    return true;
}

From source file:com.achep.acdisplay.ui.widgets.CircleView.java

public boolean sendTouchEvent(@NonNull MotionEvent event) {
    final int action = event.getActionMasked();

    // If current circle is canceled then
    // ignore all actions except of touch down (to reset state.)
    if (mCanceled && action != MotionEvent.ACTION_DOWN)
        return false;

    // Cancel the current circle on two-or-more-fingers touch.
    if (event.getPointerCount() > 1) {
        cancelCircle();/*from   www . ja v  a 2s. c  om*/
        return false;
    }

    final float x = event.getX();
    final float y = event.getY();
    switch (action) {
    case MotionEvent.ACTION_DOWN:
        clearAnimation();
        Config config = Config.getInstance();

        // Corner actions
        int width = getWidth();
        int height = getHeight();
        int radius = Math.min(width, height) / 3;
        if (MathUtils.isInCircle(x, y, 0, 0, radius)) { // Top left
            mCornerActionId = config.getCornerActionLeftTop();
        } else if (MathUtils.isInCircle(x, y, -width, 0, radius)) { // Top right
            mCornerActionId = config.getCornerActionRightTop();
        } else if (MathUtils.isInCircle(x, y, 0, -height, radius)) { // Bottom left
            mCornerActionId = config.getCornerActionLeftBottom();
        } else if (MathUtils.isInCircle(x, y, -width, -height, radius)) { // Bottom right
            mCornerActionId = config.getCornerActionRightBottom();
        } else {
            // The default action is unlocking.
            mCornerActionId = Config.CORNER_UNLOCK;
        }

        // Update colors and icon drawable.
        boolean needsColorReset = updateIcon();
        setInnerColor(getColor(config.getCircleInnerColor()), needsColorReset);
        setOuterColor(getColor(config.getCircleOuterColor()));

        // Initialize circle
        mRadiusTargetAimed = false;
        mRadiusMaxPeak = 0;
        mPoint[0] = x;
        mPoint[1] = y;
        mCanceled = false;

        if (mHandler.hasMessages(ACTION_UNLOCK)) {
            // Cancel unlocking process.
            mHandler.sendEmptyMessage(ACTION_UNLOCK_CANCEL);
        }

        mHandler.removeCallbacksAndMessages(null);
        mHandler.sendEmptyMessageDelayed(MSG_CANCEL, 1000);
        mHandler.sendEmptyMessage(ACTION_START);
        break;
    case MotionEvent.ACTION_MOVE:
        setRadius(x, y);
        break;
    case MotionEvent.ACTION_CANCEL:
    case MotionEvent.ACTION_UP:
        if (!mRadiusTargetAimed || action == MotionEvent.ACTION_CANCEL) {
            cancelCircle();
            break;
        }

        startUnlock();
        break;
    }
    return true;
}

From source file:com.csounds.examples.tests.MultiTouchXYActivity.java

/** Called when the activity is first created. */
@Override/* ww  w  . j  a v a  2s  . c o  m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    for (int i = 0; i < touchIds.length; i++) {
        touchIds[i] = -1;
        touchX[i] = -1;
        touchY[i] = -1;
    }
    /*      File outputFile = new File(DIR_NAME);
    File outputDir = this.getCacheDir(); // context being the Activity pointer
    try {
       outputFile = File.createTempFile("temp", "txt", outputDir);
    } catch (IOException e1) {
       // TODO Auto-generated catch block
       e1.printStackTrace();
    }
            
    ContextWrapper cw = new ContextWrapper(this);
    File directory = cw.getExternalFilesDir(null);
    txtfile = new File(directory,"temp.txt");
     */
    multiTouchView = new View(this);
    setContentView(R.layout.multitouchxy);
    multiTouchView = (RelativeLayout) findViewById(R.id.multitouchxy);
    Button loadPresetButton = (Button) findViewById(R.id.load_button);
    this.createLoadListener(loadPresetButton);
    multiTouchView.setOnTouchListener(new OnTouchListener() {

        /* (non-Javadoc)
         * @see android.view.View.OnTouchListener#onTouch(android.view.View, android.view.MotionEvent)
         */
        public boolean onTouch(View v, MotionEvent event) {
            final int action = event.getAction() & MotionEvent.ACTION_MASK;
            switch (action) {
            case MotionEvent.ACTION_DOWN:
            case MotionEvent.ACTION_POINTER_DOWN:

                for (int i = 0; i < event.getPointerCount(); i++) {
                    int pointerId = event.getPointerId(i);
                    int id = getTouchId(pointerId);

                    if (id == -1) {

                        id = getTouchIdAssignment();

                        if (id != -1) {
                            touchIds[id] = pointerId;
                            touchX[id] = event.getX(i) / multiTouchView.getWidth();
                            touchY[id] = 1 - (event.getY(i) / multiTouchView.getHeight());
                            //TODO calculte interval Y
                            int a = Math.round(id / 440);

                            System.out.println("y " + a);

                            if (touchXPtr[id] != null) {
                                //TODO swtich touchid
                                Log.d("touchXtouchY",
                                        "touchX[id]) " + touchX[id] + " touchY[id]) " + touchY[id]
                                                + " multitouchview width " + multiTouchView.getWidth()
                                                + " multitouchview width " + multiTouchView.getHeight());

                                // get the key from the touch coordinates
                                float[] touchArray = new float[2];
                                touchArray = evaluateTouchKey(touchX[id], touchY[id]);
                                touchX[id] = touchArray[0];
                                touchY[id] = touchArray[1];

                                Log.d("touchXtouchY",
                                        "touchX[id]) " + touchX[id] + " touchY[id]) " + touchY[id]);
                                touchXPtr[id].SetValue(0, touchX[id]);
                                touchYPtr[id].SetValue(0, touchY[id]);
                                csoundObj.sendScore(String.format("i1.%d 0 -2 %d", id, id));
                            }
                            //write file
                            /*            System.out.println(String.format(
                                  "i1.%d 0 -2 %d", id, a));
                            writeToFile(String.format(
                                  "i1.%d 0 -2 %d", id, a));
                             */
                        }
                    }

                }

                break;
            case MotionEvent.ACTION_MOVE:

                for (int i = 0; i < event.getPointerCount(); i++) {
                    int pointerId = event.getPointerId(i);
                    int id = getTouchId(pointerId);

                    if (id != -1) {
                        touchX[id] = event.getX(i) / multiTouchView.getWidth();
                        touchY[id] = 1 - (event.getY(i) / multiTouchView.getHeight());

                    }

                    //write file
                    /*         System.out.println(String.format(
                          "i1.%d 0 -2 %d", id, id));
                    writeToFile(String.format(
                          "i1.%d 0 -2 %d", id, id));
                     */
                }

                break;
            case MotionEvent.ACTION_POINTER_UP:
            case MotionEvent.ACTION_UP: {
                int activePointerIndex = event.getActionIndex();
                int pointerId = event.getPointerId(activePointerIndex);

                int id = getTouchId(pointerId);
                if (id != -1) {
                    touchIds[id] = -1;
                    csoundObj.sendScore(String.format("i-1.%d 0 0 %d", id, id));
                }
                //write file
                /*         System.out.println(String.format(
                      "i1.%d 0 -2 %d", id, id));
                writeToFile(String.format(
                      "i1.%d 0 -2 %d", id, id));
                 */
            }
                break;
            }

            return true;
        }

    });

    setContentView(multiTouchView);

    String csd = getResourceFileAsString(R.raw.multitouch_xy_kx);
    File f = createTempFile(csd);

    csoundObj.addBinding(this);

    csoundObj.startCsound(f);
}

From source file:au.gov.ga.worldwind.androidremote.client.Remote.java

@Override
public boolean onTouchEvent(MotionEvent event) {
    if (controlling) {
        velocityTracker.addMovement(event);
        velocityTracker.computeCurrentVelocity(1);

        boolean down = event.getActionMasked() == MotionEvent.ACTION_DOWN
                || event.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN;
        boolean up = event.getActionMasked() == MotionEvent.ACTION_UP
                || event.getActionMasked() == MotionEvent.ACTION_POINTER_UP;
        Finger[] fingers = new Finger[event.getPointerCount()];
        for (int i = 0; i < event.getPointerCount(); i++) {
            fingers[i] = new Finger(event.getPointerId(i), event.getX(i), event.getY(i),
                    velocityTracker.getXVelocity(i), velocityTracker.getYVelocity(i),
                    !(event.getActionIndex() == i && up));
        }/* w w w  . jav  a  2  s.  c om*/

        FingerMessage<?> message = up ? new UpMessage(fingers)
                : down ? new DownMessage(fingers) : new MoveMessage(fingers);
        communicator.sendMessage(message);
    }
    return super.onTouchEvent(event);
}

From source file:com.android.gallery3d.filtershow.imageshow.ImageShow.java

@Override
public boolean onFling(MotionEvent startEvent, MotionEvent endEvent, float arg2, float arg3) {
    if (mActivity == null) {
        return false;
    }/*from w  ww . j  ava 2s. com*/
    if (endEvent.getPointerCount() == 2) {
        return false;
    }
    return true;
}

From source file:org.deviceconnect.android.deviceplugin.theta.fragment.ThetaShootingFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.theta_shooting_mode, null);
    ThetaDeviceApplication app = (ThetaDeviceApplication) getActivity().getApplication();
    ThetaDeviceManager deviceMgr = app.getDeviceManager();
    deviceMgr.registerDeviceEventListener(this);
    mDevice = deviceMgr.getConnectedDevice();
    if (mDevice == null) {
        ThetaDialogFragment.showAlert(getActivity(), getString(R.string.theta_ssid_prefix),
                getString(R.string.theta_error_disconnect_dialog_message),
                new DialogInterface.OnClickListener() {
                    @Override/* w  w w .ja v  a 2 s. c  o m*/
                    public void onClick(DialogInterface dialogInterface, int i) {
                        getActivity().finish();
                    }
                });

        return rootView;
    }
    mShootingTime = (TextView) rootView.findViewById(R.id.shooting_time);
    mLiveView = (SphericalImageLiveView) rootView.findViewById(R.id.shooting_preview);
    mApi = app.getSphericalViewApi();
    mLiveView.setViewApi(mApi);
    mLiveView.setDeviceManager(deviceMgr);
    initShootingLayouts(rootView);
    mShootingMode = (Spinner) rootView.findViewById(R.id.theta_shooting_mode);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), R.layout.theta_shooting_mode_adapter,
            getResources().getStringArray(R.array.theta_shooting_mode));

    mShootingMode.setAdapter(adapter);
    setRetainInstance(true);
    if (mShootingTasker == null) {
        mShootingTasker = new DownloadThetaDataTask();
        ShootingModeGetTask shootingGetTask = new ShootingModeGetTask();
        mShootingTasker.execute(shootingGetTask);
    }
    mLiveView.setOnTouchListener(new View.OnTouchListener() {

        private boolean mIsEnabledLongTouch = true;

        @Override
        public boolean onTouch(final View view, final MotionEvent motionEvent) {
            if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
                mIsEnabledLongTouch = true;
                return true;
            }
            if (motionEvent.getPointerCount() == 1) {
                if (mIsEnabledLongTouch && motionEvent.getEventTime() - motionEvent.getDownTime() >= 300) {
                    mLiveView.resetCameraDirection();
                }
            } else {
                mIsEnabledLongTouch = false;
                mScaleDetector.onTouchEvent(motionEvent);
            }
            return true;
        }
    });
    mScaleDetector = new ScaleGestureDetector(getActivity(),
            new ScaleGestureDetector.SimpleOnScaleGestureListener() {
                @Override
                public boolean onScale(final ScaleGestureDetector detector) {
                    mScaleFactor /= detector.getScaleFactor();
                    double scale = mScaleFactor;
                    if (scale > MAX_FOV) {
                        scale = MAX_FOV;
                        mScaleFactor = MAX_FOV;
                    }
                    if (scale < MIN_FOV) {
                        scale = MIN_FOV;
                        mScaleFactor = MIN_FOV;
                    }
                    mLiveView.setFOV(scale);

                    return true;
                }
            });
    rotateShootingButton(getActivity().getResources().getConfiguration());
    return rootView;
}

From source file:org.mklab.mikity.android.CanvasFragment.java

/**
 * {@inheritDoc}/*from  w ww.  j  a va2s.c o m*/
 * 
 * ??????????
 */
public boolean onTouch(View v, MotionEvent event) {
    final int touchCount = event.getPointerCount();

    // ?ScaleGestureDetector#onTouchEvent????
    this.gestureDetector.onTouchEvent(event);

    switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
        if (((MainActivity) getActivity()).getSupportActionBar().isShowing() == false) {
            this.rotating = false;
            ((MainActivity) getActivity()).setFullScreenExitButtonEnabled(true);
            return true;
        }
        this.rotating = true;
        this.prevX = event.getX();
        this.prevY = event.getY();
        break;
    case MotionEvent.ACTION_MOVE:
        final float moveX = event.getX() - this.prevX;
        final float moveY = event.getY() - this.prevY;
        this.prevX = event.getX();
        this.prevY = event.getY();

        if ((this.rotating) && (touchCount == 1)) {
            float rotationY = moveY / 5;
            float rotationZ = moveX / 5;
            this.objectRenderer.rotateY(rotationY);
            this.objectRenderer.rotateZ(rotationZ);
        }

        if ((touchCount == 2) && (!this.scaling)) {
            float translationY = moveX / 2000;
            float translationZ = moveY / 2000;
            this.objectRenderer.translateY(translationY);
            this.objectRenderer.translateZ(translationZ);
            this.rotating = false;
        }
        this.rotating = true;
        break;
    case MotionEvent.ACTION_UP:
        this.prevX = event.getX();
        this.prevY = event.getY();
        break;
    case MotionEvent.ACTION_CANCEL:
        break;

    default:
        break;
    }

    this.objectRenderer.updateDisplay();
    return true;
}

From source file:org.cocos2dx.lib.TextInputWraper.java

private void dumpEvent(MotionEvent event) {
    String names[] = { "DOWN", "UP", "MOVE", "CANCEL", "OUTSIDE", "POINTER_DOWN", "POINTER_UP", "7?", "8?",
            "9?" };
    StringBuilder sb = new StringBuilder();
    int action = event.getAction();
    int actionCode = action & MotionEvent.ACTION_MASK;
    sb.append("event ACTION_").append(names[actionCode]);
    if (actionCode == MotionEvent.ACTION_POINTER_DOWN || actionCode == MotionEvent.ACTION_POINTER_UP) {
        sb.append("(pid ").append(action >> MotionEvent.ACTION_POINTER_ID_SHIFT);
        sb.append(")");
    }//from   w ww  .ja  v  a2s . c o  m
    sb.append("[");
    for (int i = 0; i < event.getPointerCount(); i++) {
        sb.append("#").append(i);
        sb.append("(pid ").append(event.getPointerId(i));
        sb.append(")=").append((int) event.getX(i));
        sb.append(",").append((int) event.getY(i));
        if (i + 1 < event.getPointerCount())
            sb.append(";");
    }
    sb.append("]");
    Log.d(TAG, sb.toString());
}