Created
May 25, 2018 17:57
-
-
Save joseprl89/08bb8b0a49f00ae74b7388669311c83c to your computer and use it in GitHub Desktop.
How the base ViewModelFactory works for https://medium.com/@josep.rodriguez/internals-of-android-architecture-components-part-i-the-viewmodel-d893e362a0d9
This file contains hidden or 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 <T extends ViewModel> T create(@NonNull Class<T> modelClass) { | |
try { | |
return modelClass.newInstance(); | |
} catch (InstantiationException e) { | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment