android - AsyncTask not show progress dialog immediate -
i used suggestion in this have same problem yet. friend suggestion using asynctask not worked me. what? code :
dbasynctask dba = new dbasynctask(this, xmlcommand); dba.inprocess = true; dba.execute(""); while (dba.inprocess) { try { thread.sleep(200); println("wwwwait"); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } } public class dbasynctask extends asynctask<string, void, string> { public boolean inprocess; public dbasynctask(exircommandrunner commandrunner,xmlnode xmlcommand) { this.commandrunner = commandrunner; this.xmlcommand = xmlcommand; } @override protected void onpostexecute(string result) { exirdebugger.println("onpostexecute"); } @override protected void onpreexecute() { showprogress(); } @override protected string doinbackground(string... params) { ///my process here closeprogress(); return null; }
can me?
thread.sleep()
blocks ui thread , therefore progress dialog cannot run. remove , inprocess
polling mechanism. also, there's lot of references on using async task progress dialog.
Comments
Post a Comment