Skip to content

Instantly share code, notes, and snippets.

@denisviana
Created December 14, 2017 16:31
Show Gist options
  • Save denisviana/485de2468e04bf6f80548c37b65952b9 to your computer and use it in GitHub Desktop.
Save denisviana/485de2468e04bf6f80548c37b65952b9 to your computer and use it in GitHub Desktop.
Teste
public LiveData<MyObject> getMyObject(){
if(mylivedata == null){
mylivedata = new MutableLiveData<MyObject>;
doHttpRequest();
}
return mylivedata;
}
public void doHttpRequest(){
// rx http request code
onNext(MyObject myobject){
mylivedata.setValue(myobject)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment