KotlinStudy/Android/Demo1/ViewModel.kt
2022-05-11 16:59:14 +08:00

11 lines
435 B
Kotlin

class CrimeListFragment : Fragment() {
private lateinit var crimeRecyclerView: RecyclerView
private var adapter: CrimeAdapter? = null
private val crimeListViewModel: CrimeListViewModel by lazy {
//ViewModelProvider.of(this).get(CrimeListViewModel::class.java)
ViewModelProvider.AndroidViewModelFactory.getInstance(context?.applicationContext as Application).create(CrimeListViewModel::class.java)
}
}