The current configuration, as used to determine which resources to retrieve, is available from the Resources' Configuration
object:
getResources().getConfiguration().orientation;
You can check for orientation by looking at its value:
int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
// In landscape
} else {
// In portrait
}
More information can be found in the Android Developer.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…