Progress Bars - updating 1% at a time



I'm working on an app that shows time progress bars. I wanted the minute progress bar in this app to tick up 1% at a time. I knew that with 60000 milliseconds in a minute, this meant that updating the progress bar every 600 milliseconds should do the trick. My calculations weren't originally precise enough, however, and you can see that before the progress bar would skip 1-3% instead of 1% at a time. This was because I was doing calculations with seconds as an Int. After I switched to doing my division with Longs instead of Integers it worked great! Code on GitHub: https://github.com/amandafarrell/TimeProgressBars

Comments

Popular posts from this blog