imagebutton - Trying to measure touch duration in android -
is there way measure touch duration of immagebutton in android? i'm building app needs use data i've found ensuring minimal duration
you should use setontouchlistener
here go
button.setontouchlistener(new ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { if(event.getaction() == motionevent.action_down){ //start calculate time here starttime = system.currenttimemillis(); } if(event.getaction() == motionevent.action_up){ estimatedtime = system.currenttimemillis() - starttime; } return true; } });
Comments
Post a Comment