java - Giving an RxJava Observable something to emit from another method -


i have variable in fragment have value change multiple times throughout fragment's life. it's triggered ui interactions, thought might idea use observable hold it, rather make of to-be-updated views fields , ui changes setter.

the value has updated through method (basically setter should call onnext() on subscriber), not through observable itself. there way rxjava's design?

in other words, i'm looking have observable field, , give new values emit (calling onnext() on subscribers) method in class.

rxjava has subjects purpose. example:

private final publishsubject<string> subject = publishsubject.create();  public observable<string> getuielementasobservable() {     return subject; }  public void updateuielementvalue(final string value) {     subject.onnext(value); } 

Comments

Popular posts from this blog

python - Installing PyDev in eclipse is failed -

PHP OOP-based login system -

c# - Nested Internal Class with Readonly Hashtable throws Null ref exception.. on assignment -