In standard Java (not specific to Android), I would accomplish this by scheduling a repeating TimerTask on a Timer.
Android provides a few other options, including postDelayed and AsyncTask. In this case, I would try to implement the progress indicator using Android's animation framework. Joe On May 6, 12:10 am, MSChoi <[email protected]> wrote: > I made an application which has a thread for a notification > progressbar. > > First time I started the thread, it works fine. > But Second time I tried to start the thread again, the application > stop with the exception. > > How can I solve this problem? > Please give me any clue. > > [==========My thread code below==================] > private class ProgressThread extends Thread { > Handler mHandler; > final static int STATE_DONE = 0; > final static int STATE_RUNNING = 1; > int outIncreamentPercent; > int mState; > > ProgressThread(Handler h) { > mHandler = h; > } > > public void run() { > int i = 0; > setState(STATE_RUNNING); > while (mState == STATE_RUNNING) { > > if (i > MAX_LOOP_COUNT) { > setState(STATE_DONE); > } else { > if (i % 100 == 0) { > outIncreamentPercent = (int) > (((float) i / MAX_LOOP_COUNT) * > 100); > > rv.setProgressBar(R.id.customProgressBar, > 100,outIncreamentPercent, false); > > mNotificationManager.notify(NOTIFICATION_ID,notification); > > try { > Thread.sleep(100); > } catch (InterruptedException e) { > // TODO Auto-generated catch > block > e.printStackTrace(); > } > } > } > i = i + LOOP_INCREMENT; > } > super.run(); > } /* sets the current state for the thread, * used to stop the thread > */ > public void setState(int state) { > mState = state; > } > > } > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group > athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

