Screen rotation in Android TV

kganandh

New member
Aug 6, 2022
1
0
0
Visit site
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 ?
 

B. Diddy

Senior Ambassador
Moderator
Mar 9, 2012
165,602
4,751
113
Visit site
Welcome to Android Central! I moved this to the Software Development forum for more specific traffic.
 

Trending Posts

Forum statistics

Threads
943,176
Messages
6,917,645
Members
3,158,860
Latest member
smokedog87