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

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -