Code example for AtomicBoolean

0
    @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);
     
    Thread background=new Thread(new Runnable() {
      public void run() {