Screen rotation in Android TV

kganandh

New member
Aug 6, 2022
1
0
0
Hello

I've been trying to rotate the App in android tv based on selection.

But the code has no impact in TV

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()
}

I'm using Kotlin

Can anyone help ?
 
Welcome to Android Central! I moved this to the Software Development forum for more specific traffic.
 

Latest posts

Trending Posts

Forum statistics

Threads
956,347
Messages
6,967,707
Members
3,163,516
Latest member
KidColoringPage