---
title: "How to slow down progressbar progression?"  
description: "How to slow down progressbar progression?"  
author: "Anonymous User"  
published: 2014-11-16  
updated: 2014-11-17  
canonical: https://www.mindstick.com/forum/12598/how-to-slow-down-progressbar-progression  
category: "android"  
tags: ["multiple threading", "loop"]  
reading_time: 1 minute  

---

# How to slow down progressbar progression?

I am using this [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) here to loop and [update](https://www.mindstick.com/forum/156353/what-is-hummingbird-update) [progress](https://yourviews.mindstick.com/view/284/devotees-arrived-in-prayagraj-while-work-is-still-in-progress) on a [custom](https://www.mindstick.com/blog/12298/use-custom-writing-services-to-get-through-the-finals) progressbar.

```
class MyThreadRunner implements Runnable {        // @Override     int count = 0;        public void run() {            try {            while (count < 90) {                Thread.sleep(10);                count += 1;                 progressBar.setProgress(count);                 progressBar.setText(count + "%");            }                } catch (InterruptedException e) {                    // TODO Auto-generated catch block                    e.printStackTrace();                }                } };
```

When it gets closer towards the [end](https://yourviews.mindstick.com/view/88503/us-iran-war-live-updates-trump-says-us-in-no-rush-to-end-iran-war) I want it to start [slowing down](https://answers.mindstick.com/qa/50409/how-to-fix-an-iphone-x-that-s-suddenly-slowing-down-keeps-freezing-and-lagging),is this possible without have to make another [while loop](https://www.mindstick.com/forum/34579/while-loop-in-python)?

## Replies

### Reply by Anonymous User

Why not just change the sleep time for values over 90?

```
    class MyThreadRunner
implements Runnable {        // @Override     int count = 0;        public void run() {            try {            while (count< 100) {                //500 is half a second...                int sleepTime = count < 90 ? 10 : 500;                Thread.sleep(sleepTime);                count +=1;                
progressBar.setProgress(count);                
progressBar.setText(count + "%");            }                } catch (InterruptedException e) {                    //TODO Auto-generated catch block                    e.printStackTrace();                }                } };     
```


---

Original Source: https://www.mindstick.com/forum/12598/how-to-slow-down-progressbar-progression

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
