0

我正在使用两个进度轮。在那,完成进度后,我如何重置第一个进度轮并启动第二个?我的代码:

        final Runnable r = new Runnable() {
        public void run() {
            running = true;

            while(progress<361) {
                pw_two.incrementProgress();
                progress++;
                try {
                    Thread.sleep(5);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
                progress = 0;

            while(progress<361) {
                pw_one.incrementProgress();
                progress++;
                try {
                    Thread.sleep(5);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
                progress = 0;

            running = false;

        }
    };

它通过单击按钮重置。但我需要在线程完成后重置。

Button increment = (Button) findViewById(R.id.btn_increment);
increment.setOnClickListener(new OnClickListener() {
 public void onClick(View v) {
 if(!running) {
       pw_two.resetCount();
   pw_one.resetCount();
   Thread s = new Thread(r);
   s.start();

  }
    }
 });
4

1 回答 1

0

使用此代码..我也在使用自定义进度轮..

if(pw_one.progress == 360) {  //  progress is valariable from Progresswheel class
pw_one.resetCount();
// then start the next one  
}

note : https://github.com/Todd-Davies/ProgressWheel
i just use this above link code..
于 2013-09-27T09:39:14.480 回答