Hi ! Maybe an easy question, but is it possible to...
# compose
l
Hi ! Maybe an easy question, but is it possible to get the context from a ViewModel subclass ?
a
There’s this specific version, don’t know how well it works with Hilt and such: https://developer.android.com/reference/androidx/lifecycle/AndroidViewModel
👍🏾 1
l
Thank you very much 🙂 I'll try by subclassing it rather.
👍 1
c
why do you want to have the context in your ViewModel? For me, it’s a Code Smell
👍 1
l
if you are using hilt, you can inject a context to a ViewModel
l
@carbaj0 I think you're right. In fact I wanted context to access internal files folder inside it.
@lesincs In fact, I'm not using Hilt in my project. But thank you anyway for the suggestion.