I have a use case within my Android application where I wish to allow the user to enter a "certain amount" of text to search on before starting a search. As the user types additional text I would like to initiate further searches using the complete text entered.
Having researched a number of options I found Jake Whartons RxBinding library and felt this would be a good solution
using code such as this:-
RxTextView.textChanges(editTextVariableName)
.debounce(500, TimeUnit.MILLISECONDS)
.subscribe(new Action1<String>() {
@Override
public void call(String value) {
// do some work with the updated text
}
});
However I cannot import Action1, is the above code no longer valid?
which dependency am I missing?
My gradle file resembles this
// https://mvnrepository.com/artifact/com.jakewharton.rxbinding2/rxbinding
implementation group: 'com.jakewharton.rxbinding2', name: 'rxbinding', version: '2.1.1'
// https://mvnrepository.com/artifact/com.jakewharton.rxbinding2/rxbinding-appcompat-v7
implementation group: 'com.jakewharton.rxbinding2', name: 'rxbinding-appcompat-v7', version: '2.1.1'
// https://mvnrepository.com/artifact/com.jakewharton.rxbinding2/rxbinding-support-v4
implementation group: 'com.jakewharton.rxbinding2', name: 'rxbinding-support-v4', version: '2.1.1'
// https://mvnrepository.com/artifact/io.reactivex.rxjava2/rxandroid
implementation group: 'io.reactivex.rxjava2', name: 'rxandroid', version: '2.0.2'
// https://mvnrepository.com/artifact/io.reactivex.rxjava2/rxjava
implementation group: 'io.reactivex.rxjava2', name: 'rxjava', version: '2.1.10'
As per the documentation of RxJava 2 "Action1 has been renamed to Consumer" so it still exists and has not been deprecated, just renamed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With