Y
Y
Yaroslav Belash2016-06-20 18:18:58
Java
Yaroslav Belash, 2016-06-20 18:18:58

How to implement infinite addition and subtraction of ProgressBar?

It is necessary to make the value of the progress of the bar increase indefinitely to the maximum (50), and then decrease to the minimum (0). After each increment of the bar value, you need to wait a few milliseconds so that the value of the progress bar smoothly increases and decreases. How is it possible to implement?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
Hakito, 2016-06-20
@hakito

It is possible through AsyncTask. In it, you start an endless loop, set the desired delay and change the progress as you like. The main thing is to stop it in time so that there is no memory leak due to the fact that the garbage collector cannot utilize your progress bar. It's like an option. But it seems to me that it would be more efficient to do this through animations.

A
aol-nnov, 2016-06-21
@aol-nnov

In indeterminate mode, the progress bar shows a cyclic animation without an indication of progress.
every toolkit has such a flag.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question