Can I use a service to handle multi-touch events?

烈酒焚心 提交于 2019-12-12 04:57:20

问题


I want to write a multi-touch functionality in a service.How can I change single-touch to multi-touch in this servic?

I found in this case e.getPointerCount() always == 1. Any idea?

Thanks at first!

public void onCreate(){
    super.onCreate();
    startForeground(1, new Notification());
    mViewService = ViewService.getInstance(this);
    mViewService.addView(ViewService.TOUCH_VIEW);
    mViewService.getView(ViewService.TOUCH_VIEW).setOnTouchListener(new TouchListener());
}


class TouchListener implements View.OnTouchListener{

    @Override
    public boolean onTouch(View v, MotionEvent e){
       int pointerCount=e.getPointerCount();
       //question: why pointerCount always == 1?I wanna >=3.
       //how can I chance to multi-touch.
    }

   }

来源:https://stackoverflow.com/questions/25661708/can-i-use-a-service-to-handle-multi-touch-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!