How to create Countdown timer in Android till a specific date -


i creating app event in future , want countdown till date , time. have checked many questions regarding couldn't find exact code that. want app take time system , subtract future time , gets updated every second.

simply create new date , convert time, pass time countdowntimer , wait

you can way

simpledateformat dformat = new simpledateformat("dd-mm-yyyy");     date date = null;     try {         date = dformat.parse("20-09-2014"); // change date     } catch (parseexception e) {         e.printstacktrace();     }     //      .gettime() conversion: date --> long     countdowntimer cdt = new countdowntimer(date.gettime(), 1000) {          public void ontick(long millisuntilfinished) {             // todo auto-generated method stub          }          public void onfinish() {             // todo auto-generated method stub          }     }.start(); 

the ontick method triggred every 1s can change changing 1000 value in second paramater of countdowntimer constructor


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -