daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Mar 26th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // emit an observable every time interval
  2. Observable<Long> intervalObservable = Observable
  3.         .interval(1, TimeUnit.SECONDS)
  4.         .subscribeOn(Schedulers.io())
  5.         .takeWhile(new Predicate<Long>() { // stop the process if more than 5 seconds passes
  6.             @Override
  7.             public boolean test(Long aLong) throws Exception {
  8.                 return aLong <= 5;
  9.             }
  10.         })
  11.         .observeOn(AndroidSchedulers.mainThread());
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top