문제

I'm developing an app that essentially is Paint style. The user touchs the screen and can draw images. However I would like to measure the speed of the user's movements. At the moment I take the distance between the X and Y coordinates of the event.getX/Y and the previous values and calculate the difference. This is directly proportional to the speed of the movement provided that the timing intervals of the onTouchListener are constant. Is this the case for Android? I know for iPhone the Listener actually changes it's frequency depending on the input.

Furthermore if it is a constant value, does anyone know what it is? So I can portray the speed in useful units (mm/sec) rather than an arbitrary value.

도움이 되었습니까?

해결책

I don't think it's the same for Android (but I have to say I'm not 100% sure). But since this could potentially differ even between manufacturers, could you not look at System.currentTimeMillis() on the two events, to calculate the speed yourself?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top