-
Notifications
You must be signed in to change notification settings - Fork 4
4. Basic Usage
Zidd edited this page Jan 25, 2022
·
1 revision
To get DataBinding and ViewModel implementation
class HomeActivity : CoreActivity<ActivityHomeBinding, HomeViewModel>(R.layout.activity_home) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// auto generate binding and viewModel variable
binding.lifecycleOwner = this
binding.viewModel = viewModel
}
}
To get DataBinding without ViewModel implementation
class HomeActivity : NoViewModelActivity<ActivityHomeBinding>(R.layout.activity_home) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// auto generate binding variable
binding.lifecycleOwner = this
}
}
To open activity with AndroidCore library, simple call openActivity<T>()
function.
// HomeActivity.kt
openActivity<DetailActivity>()
// HomeActivity.kt
openActivity<DetailActivity> {
putExtra("key_id", 1)
putExtra("key_name", "awesome")
}
coming soon