Skip to content

Instantly share code, notes, and snippets.

@miquelbeltran
Created May 27, 2017 13:28
Show Gist options
  • Select an option

  • Save miquelbeltran/51b3cb82769d99d94c53556dc4d0ff7d to your computer and use it in GitHub Desktop.

Select an option

Save miquelbeltran/51b3cb82769d99d94c53556dc4d0ff7d to your computer and use it in GitHub Desktop.
class BooksViewModel extends ViewModel {
private MutableLiveData<List<Book>> books;
LiveData<List<Book>> getBooks() {
if (books == null) {
books = new MutableLiveData<List<Book>>();
}
return books;
}
public void loadBooks(String query) {
// Here we will load the books from the Google Books API
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment