VOOZH about

URL: https://www.geeksforgeeks.org/kotlin/detect-screen-orientation-in-android-using-jetpack-compose/

⇱ Detect Screen Orientation in Android using Jetpack Compose - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Detect Screen Orientation in Android using Jetpack Compose

Last Updated : 23 Jul, 2025

In Android, Screen Orientation is an important aspect where the user would like to run an activity in Fullscreen or a Wide Landscaped mode. Most commonly running applications that can switch between portrait and landscape mode can be Image Viewers, Video Players, Web Browsers, etc.

In such applications, it is important to detect screen orientation to display content likewise.

👁 Screen Orientation in Android

So in this article, we will show you how you could detect Screen Orientation in Android using Jetpack Compose. Follow the below steps once the IDE is ready.


Steps to Implement Detect Screen Orientation

Step 1: Create a New Project in Android Studio

To create a new project in the Android Studio, please refer to How to Create a new Project in Android Studio with Jetpack Compose.

Step 2: Working with the MainActivity.kt file

Go to the MainActivity.kt file and refer to the following code. Below is the code for the MainActivity.kt file. Comments are added inside the code to understand the code in more detail.

MainActivity.kt:

Output:

Comment
Article Tags:

Explore