Get phone orientation but fix screen orientation to portrait
I want to get the phone orientation but keep the screen orientation to portrait. So no matter the user turns the phone to landscape or portrait, the view stays the same, but I can get whether it is turned to landscape or portrait. Setting the activity to android:screenOrientation="portrait" will fix both but I wouldn't be able to detect the phone orientation via public void onConfigurationChanged(Configuration newConfig) { switch (newConfig.orientation) { case Configuration.ORIENTATION_PORTRAIT: Toast.makeText(this, "Portrait", Toast.LENGTH_SHORT).show(); break; case Configuration.ORIENTATION