We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
delay
Sample codes below:
EditText editText = ... ViewObservable.text(editText) .delay(1000, TimeUnit.MILLISECONDS) .subscribe(new Action1<EditText>() { @Override public void call(EditText editText) { Log.d("TAG", editText.getText().toString()); } });
Nothing printed out as I type in the editText. But if I comment out the delay line, everything works fine. am I missing something?
The text was updated successfully, but these errors were encountered:
It's probably the issue with the main thread. action after delay is executed on computation scheduler (see https://github.com/ReactiveX/RxJava/wiki/Scheduler#default-schedulers-for-rxjava-observable-operators) So you end up working with view not from main thread.
computation
Try to put .observeOn(AndroidSchedulers.mainThread()) after delay line.
.observeOn(AndroidSchedulers.mainThread())
Update: or you can retrieve text value from EditText via map operator before the delay
EditText
map
Sorry, something went wrong.
@Yarikx 👍 Thx! Problem solved :-)
ViewObservable.text()
Observable.delay()
No branches or pull requests
Sample codes below:
Nothing printed out as I type in the editText. But if I comment out the
delay
line, everything works fine. am I missing something?The text was updated successfully, but these errors were encountered: