The best way to learn swimming is by diving into the deep end of the pool (jk, that's terrible advice). It's great for learning RxJava though. Slides from a talk I gave at the SF Android meetup
a delay Observable.timer(START_DELAY, TimeUnit.SECONDS) Demo! // executing task with delay, every X seconds Observable.timer(START_DELAY, POLL_INTERVAL, TimeUnit.SECONDS) // nicer api Observable.interval(POLL_INTERVAL, TimeUnit.SECONDS); // execute at an interval but only 20 times Observable.interval(POLL_INTERVAL, TimeUnit.SECONDS) .take(20) ... .flatMap() .map()
.observeOn(AndroidSchedulers.mainThread())) .subscribe( new Observer<OnTextChangeEvent>() { @Override public void onCompleted() {} @Override public void onError(Throwable e) {} @Override public void onNext(OnTextChangeEvent onTextChangeEvent) { _log(format("You searched for %s", onTextChangeEvent.text().toString())); } }); For Smarter Auto Complete