android - Infinite calling some function after certain time -
i've tried time&timertask, handler&runnables, nothing makes function called after time. please, me rid of this.
when = system.currenttimemillis(); t1 = new timer(); tt = new timertask(){@override public void run(){ systemclick();}}; t1.scheduleatfixedrate(tt, when+interval, interval); and one:
final handler myhandler = new handler(); runnable runnableforadd = new runnable() { public void run() { systemclick(); myhandler.postdelayed(this, interval); } }; myhandler.postdelayed(runnableforadd, when + interval); both first , second execute in oncreate(). systemclick() doesn't called 1 time in deed (i've put toast in there). don't understand in threads well.
systemclick - function, system performs click of button - mybutton.performclick() called there (and other functions well).
how can solve this?
thanks
the value in delay time should value want method wait for. example if want call method after waiting 1 minute pass 60000.
myhandler.postdelayed(runnableforadd, 60000); currently adding "wait" in delay time system.currenttimemillis() means method called after approx "1338900000000" milliseconds
Comments
Post a Comment