Skip to content

Instantly share code, notes, and snippets.

@user-mw
Created December 7, 2019 09:50
Show Gist options
  • Save user-mw/64850d9bafaf2114cd2b7cf999c59470 to your computer and use it in GitHub Desktop.
Save user-mw/64850d9bafaf2114cd2b7cf999c59470 to your computer and use it in GitHub Desktop.
ViewModelProivder get() 2017
public class ViewModelProvider {
DEFAULT_KEY = "android.arch.lifecycle.ViewModelProvider.DefaultKey";
// Code
public <T extends ViewModel> T get(Class<T> modelClass) {
String canonicalName = modelClass.getCanonicalName();
// Code
return get(DEFAULT_KEY + ":" + canonicalName, modelClass);
}
// Code
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment