java - Measure the timing of user screen touches -
i developing app android in taking vibration pattern user using screen touches , saving in array. e.g
long[] pattern = {100, 200,150};
first 100ms vibrate next 200ms not vibrate vibrate next 150ms. want create values depending on user input.
i using timer
class, , save time spent between 2 touches user. being novice in java not able figure out how implement above logic, convert user touch pattern in above array.
any other more efficient logic welcome.
i start subclassing view , overriding touch event methods allow great deal of control:
@override public boolean dispatchtouchevent(motionevent ev) { return super.dispatchtouchevent(ev); }; @override public boolean ontouchevent(motionevent ev) { return super.ontouchevent(ev); } @override public boolean onintercepttouchevent(motionevent ev) { return false; }
after have have local variable records time of each touch event, calculate delta time. post may of use. attach ontouchlistener view.
Comments
Post a Comment