If there any support Library function that could make the setCountDown
function of the chronometer support by APIs lower than 24?
You can try RXJava to simple handle threads, timers, and many other functionalities.
The documentation for the timer operator says this:
Create an Observable that emits a particular item after a given delay
Thus the behavior you are observing is expected- timer() emits just a single item after a delay.
The interval operator, on the other hand, will emit items spaced out with a given interval.
For example, this Observable will emit an item every second:
Observable.interval(1, TimeUnit.SECONDS);
And an complete example:
Observable.interval(1,TimeUnit.SECONDS, Schedulers.io())
.take(300) // take 300 second
.map(v -> 300 - v)
.subscribe(
onNext -> {
//on every second pass trigger
},
onError -> {
//do on error
},
() -> {
//do on complete
},
onSubscribe -> {
//do once on subscription
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With