KotlinStudy/Android/Demo1/ViewModel.kt

11 lines
435 B
Kotlin
Raw Normal View History

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)
}
}