Skip to content

Instantly share code, notes, and snippets.

@seventhmoon
Created July 18, 2020 15:16
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 seventhmoon/53e359eb71d93fd04a48144c6f40df0b to your computer and use it in GitHub Desktop.
Save seventhmoon/53e359eb71d93fd04a48144c6f40df0b to your computer and use it in GitHub Desktop.
AndroidViewModel KTX
protected open fun AndroidViewModel.getString(@StringRes resId: Int) =
getApplication<Application>().resources.getString(resId)
protected open fun AndroidViewModel.getStringArray(@ArrayRes resId: Int): Array<String> =
getApplication<Application>().resources.getStringArray(resId)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment