With thread Control dialog rendering time, the idea is very simple, direct show code, I also for the convenience of their records
private void Showprogressdialog () {pdialog = new ProgressDialog (mcontext);pD Ialog.setprogressstyle ( Progressdialog.style_spinner);pD ialog.setprogress (+);pD ialog.setmessage ("Please wait a second ...");pD ialog.setindeterminate (false);pD ialog.show (); Windowmanager.layoutparams LP = Pdialog.getwindow (). GetAttributes (); lp.gravity = Gravity.center; Window win = Pdialog.getwindow (); win.setattributes (LP);//Render only 1snew Thread (new Runnable () {@Overridepublic void run () { Long startTime = System.currenttimemillis (), int progress = 0;while (System.currenttimemillis ()-startTime <) {Try {Progress + = 10;pdialog.setprogress (progress); Thread.Sleep (100);} catch (Interruptedexception e) {Pdialog.dismiss ();}} Pdialog.dismiss ();}}). Start ();}