1 year ago
#302806
Bialy
CountDownTimer doesn't count down by the specified intervals
I'm trying to build a count-down timer function in my app, however, it doesn't run as expected.
timer = new CountDownTimer(100, 10) {
@Override
public void onTick(long l) {
Log.d(TAG, "onTick: " + l);
}
@Override
public void onFinish() {
}
}.start();
My expectations are that it would count down gradually from 100,90,80...till 0
Although the output timer is showing quite random times (34 then 18 then 8..etc). How can I achieve what I want?
It's difficult to explain the exact idea I'm trying to achieve but basically, I'm using touch listeners to hover over an item which in turn loads a few other items in the view. For some reason, there should be an intentional delay of around 100ms before these items could be displayed. I'm trying to build a progress bar that tells the user that something is loading rather than giving the impression that the screen is just stuck. I hope that helps to give a better idea of what I'm trying to achieve
java
android
android-studio
countdown
0 Answers
Your Answer