Skip to content

Instantly share code, notes, and snippets.

@cdmunoz
Created March 8, 2018 02:20
Show Gist options
  • Select an option

  • Save cdmunoz/8e693ea06f21bf842f48f3ff42cb1a85 to your computer and use it in GitHub Desktop.

Select an option

Save cdmunoz/8e693ea06f21bf842f48f3ff42cb1a85 to your computer and use it in GitHub Desktop.
class CryptocurrenciesViewModelFactory @Inject constructor(
private val cryptocurrenciesViewModel: CryptocurrenciesViewModel) : ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
if (modelClass.isAssignableFrom(CryptocurrenciesViewModel::class.java!!)) {
return cryptocurrenciesViewModel as T
}
throw IllegalArgumentException("Unknown class name")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment