Search code examples
androidrx-androidrx-javafx

RxJava + RxAndroid WidgetObservable new API


A few weeks ago this code worked fine with RxAndroid v0.25.0

Observable<OnTextChangeEvent> usernameObservable = WidgetObservable.text(editText);

usernameObservable
  .filter(e -> e.text.length() >= 3)
  .subscribe(e -> log(e.text().toString()));

Since the RxAndroid v1.0.0 release https://github.com/ReactiveX/RxAndroid/releases/tag/v1.0.0

Jake Wharton said that ViewObservable and WidgetObservable: are available here https://github.com/JakeWharton/RxBinding

And although I have this imports:

compile 'io.reactivex:rxjava:1.0.14'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'com.jakewharton.rxbinding:rxbinding:0.2.0'

That code doesn't work and I can't find any documentation.

Do you have any code sample on how to do this simple thing?

Am I missing something obvious?


Solution

  • I found that TextView is the parent of EditText so acording to the RxBinding:

    RxTextView.textChangeEvents(email)
      .filter(e -> e.text.length() >= 3)
      .subscribe(e -> log(e.text().toString()));