onNext of a created Observable does not work


onNext of a created Observable does not work
I am learning how to use Observable.create(). so i created the below posted example. but when I run the App. and click the button the log statement in the
onNext is never displayed. and i receive the following message:
The application may be doing too much work on its main thread.
please let me know how to do it the corret way.
code:
Observable.create(emitter -> {
btnStart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
emitter.onNext(Log.i(TAG, "i: " + i[0]++));
}
});
});
Observable
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
How do you consume this
Observable
? The code shown barely does anything so it is unlikely you get the warning for this piece of code.– akarnokd
44 secs ago