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

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -