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

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -