• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Screen rotation in Android 9 based smart tv

kganandh

Lurker
Hello

I've been trying to rotate the screen in my Android 9 based smart tv but it is not working.
buttonLandscape.setOnClickListener {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
Toast.makeText(baseContext, "Landscape Orientation", Toast.LENGTH_SHORT).show()
}
buttonPortrait.setOnClickListener {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
Toast.makeText(baseContext, "Portrait Orientation", Toast.LENGTH_SHORT).show()
}

Can anyone help on this ?
 
Back
Top Bottom