I'm trying to overload the funcion to detect an screen orientation change with the following code in a class that inherits from Fragment class.
override fun onConfigurationChanged(newConfig: Configuration?) {
newConfig?.let { super.onConfigurationChanged(it) }
if (newConfig != null) {
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
Handler().postDelayed({
otrosScrollView.fullScroll(ScrollView.FOCUS_UP)
},600)
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
Handler().postDelayed({
otrosScrollView.fullScroll(ScrollView.FOCUS_UP)
},600)
}
}
}
But it gives the error that onConfigurationChanged overrides nothing, so not sure how to handle the issue.
What could I do so a fragment reacts to the mentioned event?
This can happen when you update the sdk for a project and a function definition has changed. In this case, it looks like onConfigurationChanged() no longer accepts a nullable type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With