Observable.interval(1, TimeUnit.SECONDS,Schedulers.newThread()).subscribe....
"0,1,2,3,4,5..." why ??? I test this in a java module with Android Studio.
I've tested that this prints 0 to 19 then exits.
public class Main {
public static void main(String[] args) throws InterruptedException {
Observable.interval(1, TimeUnit.SECONDS, Schedulers.newThread()).subscribe(System.out::println);
Thread.sleep(20_000); // if this is missing then the JVM exits immediately and the new thread is stopped.
}
}
Can we close this? @abersnaze made correct statement about finishing of the main thread.
Usually, I wait for thanks or some other indicative response, or 30 days.
I wait for thanks
Thanks!
um........

Is that the perfect solution? I have occurred this problem in Android development with rxjava 1.3.8. It lost so many events like the screenshot above.
The number of seconds is 07,11,12,13,27,28,32,33. where is 08,09,10,14...etc? Is that a bug? or I am not using it right?
You could simply specify interval(1, 1, TimeUnit.SECONDS, Schedulers.newThread()).
As for the skips, afaik the logging on android sometimes coalesces output if it looks the same. If you print the aLong there, that should get you a monotone sequence of values.
@akarnokd
Thank you. You are right.
The logging on android do coalesces output if it looks the same.
I have tried print the aLong there, it will not missing any events.
Most helpful comment
I've tested that this prints 0 to 19 then exits.