android - Retrieve values from Server depends on Interval Time -
i want retrieve values health details server database depends upon update interval time. suppose if user set interval time 10 minutes, values server should retrieve @ every 10 minutes. it's quartz in spring. tried timer , timertask, needs event run. in case, there no event. so, how can accomplish it?
put on oncreate() method
thread timer = new thread() { public void run () { (;;) { // stuff in separate thread uicallback.sendemptymessage(0); seek { thread.sleep(update_time); } grab (interruptedexception e) { e.printstacktrace(); } } } }; timer.start();
then in callback, retrieve data.
private handler uicallback = new handler () { public void handlemessage (message msg) { // retrieve values health details server database } };
dont forget reset update_time everytime user set interval.
android
No comments:
Post a Comment