Android 1.5 Multitouch

妖精的绣舞 提交于 2019-12-24 01:24:50

问题


Does anyone know if it's possible to use Multitouch on an Android 1.5 device?

I have a HTC Hero, and it's still running 1.5 (HTC have been a little slow on getting the 2.1 ROM out).

The Android MotionEvent documentation shows the constants (ACTION_POINTER_1_DOWN, ACTION_POINTER_1_UP.....etc...) I need to implement multitouch as only avaliable from API 5 :(

Is there a way round this other then waiting for HTC to get the update out or buying a 2.1 handset?

Code Snippet:

public boolean onTouchEvent (MotionEvent event) {
    //TODO: determine if the event object is an ACTION_POINTER_DOWN etc...

    //for ACTOIN_DOWN it is
    if(event.getAction() == MotionEvent.ACTION_DOWN) {
        //do something here.....
    }
}

回答1:


This post discusses it a bit in the context of users. It would stand to reason that if the browser supports it (I'm assuming your hero has the requisite hardware...) you as a developer could access it. That said, it's possible that it's not part of the public api but even if that's the case, you could just use reflection to call the methods. This isn't a great answer, but you could download the cupcake source from the repo and dig through the browser code to see how they implement the multitouch stuff.




回答2:


here you have an example, it works fine on my Hero, but I still have issues with my onscroll method which is called sometimes, since there is no builtin events to tell my Activity I am zooming.



来源:https://stackoverflow.com/questions/2668828/android-1-5-multitouch

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