I think this code may work after orientation change has take effect
Display getOrient = getWindowManager().getDefaultDisplay();
int orientation = getOrient.getOrientation();
override Activity.onConfigurationChanged(Configuration newConfig) function and use newConfig,orientation if you want to get notified about the new orientation before calling setContentView.