Reputation: 197
I want to use this context to make a notification, but it should be called in a viewmodel that is made by hiltViewModel()
function. How should I pass the context there?
Upvotes: 0
Views: 1336
Reputation: 6835
I'd recommend creating a single method that accepts a context and displays the notification. This way you'll avoid memory leaks which can be caused if you store the activity's context instead.
Upvotes: 1