Android: Time delay in a loop with updating UI -
Android: Time delay in a loop with updating UI -
what i'm trying create simple progress bar, load ~10 sec. want loop this:
for(int = 1; <= 100; i++) { progressdialog.setprogress(i); //100ms delay }
thanks
the next code may helpful you.
public void startprogress(view view) { // long runnable runnable = new runnable() { @override public void run() { (int = 0; <= 10; i++) { final int value = i; seek { thread.sleep(1000); } grab (interruptedexception e) { e.printstacktrace(); } handler.post(new runnable() { @override public void run() { progressdialog.setprogress(value); } }); } } }; new thread(runnable).start(); }
android loops time delay progress
Comments
Post a Comment