-
-
Save gonzalonm/f31560b83d56abe1b5e0e6003fd8d9f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyViewModel extends ViewModel { | |
private MutableLiveData<List<Article>> articles; | |
public LiveData<List<Article>> getArticles() { | |
if (articles == null) { | |
articles = new MutableLiveData<List<Article>>(); | |
loadArticles(); | |
} | |
return articles; | |
} | |
private void loadArticles() { | |
// do async operation to fetch articles | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment