본문 바로가기

그 외 코드/오류 해결

LiveData 데이터 바인딩 안될 때

728x90
반응형
SMALL

 

 

binding.lifecycleOwner = this 

를 써주었는지 확인할 것!

 

private val viewModel by viewModel<MainViewModel>() // koin
private lateinit var binding: ActivityMainBinding

override fun onCreate(savedInstanceState: Bundle?) {
     super.onCreate(savedInstanceState)
     binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
     binding.viewModel = viewModel
     binding.lifecycleOwner = this

}

 

 

 

728x90
반응형
LIST