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

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -