Answers for "find context kotlin"

1

context kotlin

don't send context to another class, it's not efficient, 
instead manage where context is remotely with structures like viewModel
Posted by: Guest on December-09-2021
0

get context in view model kotlin

class ActivityViewModel(application: Application) : AndroidViewModel(application) {

    private val context = getApplication<Application>().applicationContext

    //... ViewModel methods 

}
Posted by: Guest on September-02-2021

Browse Popular Code Answers by Language