Code example for ProgressBar

Methods: incrementProgressBy

1
public class HandlerDemo extends Activity {
  ProgressBar bar;
  Handler handler=new Handler() {
    @Override 
    public void handleMessage(Message msg) { 
      bar.incrementProgressBy(msg.arg1); 
    } 
  }; 
  AtomicBoolean isRunning=new AtomicBoolean(false);
   
  @Override 
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    bar=(ProgressBar)findViewById(R.id.progress);
  } 
   
  @Override 
  public void onResume() { 
    super.onResume(); 
    bar.setProgress(0);