Sheehan Alam Sheehan Alam - 3 months ago 7
Android Question

How can I get the current screen orientation?

I just want to set some flags when my orientation is in landscape so that when the activity is recreated in onCreate() i can toggle between what to load in portrait vs. landscape. I already have a layout-land xml that is handling my layout.

public void onConfigurationChanged(Configuration _newConfig) {

if (_newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
this.loadURLData = false;

if (_newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
this.loadURLData = true;


Over-riding onConfigurationChanged will prevent my layout-land xml from loading in landscape orientation.

I just want to get the current orientation of my device in onCreate(). How can I get this?