I know passing views to ViewModel classes causes memory leaks but will it also cause memory leaks if I pass a view, let's say, a ProgressBar, in to an AndroidViewModel class like the following?
class MainActivityViewModel (application: Application, progressBar: ProgressBar): AndroidViewModel(application) {
var name: LiveData<String> = Transformations.map(docRef) {
progressBar.visibility = View.GONE
it.getString("string")
}
}
I'm going to be using Data Binding to call name from my layout file like android:text="@{viewModel.name]".
Will the above code cause a memory leak?