I have 3 EditText fields and I have created 3 observables for these fields.
Observable<CharSequence> o1 = RxTextView.textChanges(field1);
Observable<CharSequence> o2 = RxTextView.textChanges(field2);
Observable<CharSequence> o3 = RxTextView.textChanges(field3);
I want to enable a button when all these three fields has some value in it. user can enter values in any order in the fields. How can i do that?
EDIT
I used zip to achieve that.
Observable<CharSequence> o1 = RxTextView.textChanges(field1);
Observable<CharSequence> o2 = RxTextView.textChanges(field2);
Observable<CharSequence> o3 = RxTextView.textChanges(field3);
Observable.zip(o1, o2, o3, (c1, c2, c3) -> c1.length() > 0 && c2.length() > 0 && c3.length() > 0).subscribe(myButton::setEnabled)
this above case works when i enter something in all three text fields. e.g. i entered 1 character in all three text fields then the button will be enabled. But when I delete a character in any of the three fields. zip will not get called as it will be waiting for the other 2 textfields to stream some data before it calls onNext on the subscriber. so when I delete any character in any textfield I want my button to get disabled again. How can I achieve that?