android - Can someone please explain or walkthrough a progress bar as a timer -


yes, know android developers site. i've scoured internet day trying figure out happening here , how can incorporate timer kegel app i'm trying make (personal use because don't ones on market). anyhow, i'm not familiar handlers or threads , how used. if point me in right direction, appreciate it.

 public class myactivity extends activity {  private static final int progress = 0x1;   private progressbar mprogress;  private int mprogressstatus = 0;   private handler mhandler = new handler();   protected void oncreate(bundle icicle) {      super.oncreate(icicle);       setcontentview(r.layout.progressbar_activity);       mprogress = (progressbar) findviewbyid(r.id.progress_bar);       // start lengthy operation in background thread      new thread(new runnable() {          public void run() {              while (mprogressstatus < 100) {                  mprogressstatus = dowork();                   // update progress bar                  mhandler.post(new runnable() {                      public void run() {                          mprogress.setprogress(mprogressstatus);                      }                  });              }          }      }).start();  } 

}


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -