I've searched but found nothing so far... or I'm just confuse what should I look for.
What I'm trying to do is, a subscription will be made and will check if variable X is TRUE. If not it will wait until it turns to TRUE and execute the succeeding events.
I'm looking into the repeat() method but not sure how it works... any suggestion is very much appreciated...
Just emit your variable in a observable, and filter
it. You can use a PublishSubject
to emit your variable.
PublishSubject<Boolean> subject = PublishSubject.create();
void updateBoolean(boolean b) {
subject.onNext(b);
}
// latter in your code
subject.filter(b -> b)
.subscribe(b -> /* do something here only if b is true */);
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