How to allow single multitouch
Asked Answered
P

1

0

I am writing an custom ViewGroup where I need to use only single finger touch and wanted to remove multitouch completely. I have checked with other option android:splitMotionEvents="false" android:windowEnableSplitTouch="false" but both are not working.

EDIT

@Override
    public boolean onTouchEvent(MotionEvent ev) {

        DragHelper.processTouchEvent(ev);

        return true;
    }

Any suggestion !

Pistol answered 16/3, 2015 at 8:49 Comment(2)
why do you think they are not working?Outrelief
Update question: Here I wanted to try single finger touch event but on multitouch it gave IndexOutOfBound.Pistol
S
0

Try following code in your custom view.

@Override
public boolean onTouchEvent(MotionEvent event) 
{
    // TODO Auto-generated method stub
    if(event.getPointerCount() > 1) {
        System.out.println("Multitouch detected!");
        return true;
    }
    else
    {
        return super.onTouchEvent(event);
    }
}
Somniferous answered 16/3, 2015 at 8:55 Comment(1)
yes that is true...but I wanted to map single touch event to ViewDragHelper. Please check updated answer.Pistol

© 2022 - 2024 — McMap. All rights reserved.