Skip to content

Instantly share code, notes, and snippets.

@anitaa1990
Created August 17, 2018 17:09
Show Gist options
  • Save anitaa1990/f249bcd1be6f562220d923b14e073e41 to your computer and use it in GitHub Desktop.
Save anitaa1990/f249bcd1be6f562220d923b14e073e41 to your computer and use it in GitHub Desktop.
/*
* This will print values from 0 after every second.
*/
Observable.interval(1, TimeUnit.SECONDS)
.subscribe(new Observer<Long>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(Long value) {
System.out.println("onNext: " + value);
}
@Override
public void onError(Throwable e) {
System.out.println("onError: " + e.getMessage());
}
@Override
public void onComplete() {
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment