I have 2 questions about android TrackBall Event. I appreciate if you can help me with them:
Can I detect the speed of TrackBall event? like in Fling, I can detect a 'big' fling vs a 'small' fling. Can I fling via the track ball?
Why TrackBall Event always follow by Key left/right events? To me, they seem duplicate.
For example, I put debug statement in both dispatchTrackballEvent() and dispatchKeyEvent(), and i switch to 'track ball' mode in emulator. When I move my mouse around, I always see dispatchTrackballEventevent with dispatchKeyEvent.
Thank you for any help.
Answers to your doubts:
TrackBall events in android send you a MotionEvent object (docs), from that object you can read historical info that let's you make a delta of movement, that way you can know with which intensity the ball was rolled.
That is caused because you are not telling the system that you have consumed the event in your onTrackBallEvent handler (docs), if you don't return true the event is then raised as a d-pad key event.