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

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -