I have a class which runs in the background and handles the business logic, and it contains state variable like so. The implementation of the State
enum is inside the interface implemented by Common
class.
class Mine extends Common {
public State state;
}
I have a view model which has one LiveData
member to call the state of Mine
class, Mine
has been implemented with a Singleton pattern so I use Mine.getInstance().state
to access state.
class MineViewModel : ViewModel() {
val state: Flowable<State> = Flowable.fromCallable { return@fromCallable Mine.getInstance().state }
private var _status : LiveData<State> = LiveDataReactiveStreams.fromPublisher(state)
val status: LiveData<State>
get() = _status
}
I update my UI with the help of the Binding Adapter on MineViewModel
and fragment. Right now, I'm unable to update the _status
in the View Model. I get the first value which for the sake of argument here is CREATED
. I'm not sure what I am missing.
