【发布时间】:2021-01-25 16:09:28
【问题描述】:
在渲染活动之前我需要做一份工作
设置内容视图
这个例子是否正确,如果不是,在这种情况下午餐协程的最佳方式是什么
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
lifecycleScope.launchWhenCreated {
if (dataStoreRepository.getLanguage() == ARABIC)
window.decorView.layoutDirection = View.LAYOUT_DIRECTION_RTL
else
window.decorView.layoutDirection = View.LAYOUT_DIRECTION_LTR
}
super.onCreate(savedInstanceState, persistentState)
}
【问题讨论】:
标签: android android-activity android-lifecycle coroutine