Answer the question
In order to leave comments, you need to log in
RxJava + Android how to set the minimum function execution time?
Essence of the question:
- when downloading data from the network, we show the progress bar, it is necessary that there be a minimum function execution time of 1 sec, so that there would be no blinking (if the Internet is fast and the data is loaded in 0.0001 sec), i.e. if the data loaded, for example, in less than 1 second, then we still wait for this 1 second to pass.
The options when we wait 1 second for nothing are very bad, it is necessary that at this time we have already loaded the data.
well, respectively, we are talking about RX, how to do it?
Answer the question
In order to leave comments, you need to log in
A snippet of measuring the execution time of a method from SO:
long startTime = System.nanoTime();
methodToTime();
long endTime = System.nanoTime();
long duration = (endTime - startTime); //divide by 1000000 to get milliseconds.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question