Skip to content

Instantly share code, notes, and snippets.

@AkshayChordiya
Last active July 5, 2017 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkshayChordiya/327cccecd0c4bb1785bd31bea9390aa8 to your computer and use it in GitHub Desktop.
Save AkshayChordiya/327cccecd0c4bb1785bd31bea9390aa8 to your computer and use it in GitHub Desktop.
Simple ViewModel class with context
class ContextViewModel(application: Application) : AndroidViewModel(application) {
/**
* The data
*/
private var data: List<Data>
init {
// Load the data over here
// data = ....
}
/**
* Get all the data
*/
fun getDataList() = data
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment