画面の向きの取得方法

Android Wiki* 画面の向き(ScreenOrientation) より引用

現在の画面の向きはActivityから下記のように取得できます。

Configuration config = getResources().getConfiguration();
// Landscape(横長)
if(config.orientation == Configuration.ORIENTATION_LANDSCAPE) { 
    Toast toast = Toast.makeText(this, "Landscape", Toast.LENGTH_SHORT);
    toast.show();
} 
// Portrait(縦長)
else if (config.orientation == Configuration.ORIENTATION_PORTRAIT) {
    Toast toast = Toast.makeText(this, "Portrait", Toast.LENGTH_SHORT);
    toast.show();
}
// Square(正方形) エミュレータではこの値は返って来ない。
else if (config.orientation == Configuration.ORIENTATION_SQUARE) {
    Toast toast = Toast.makeText(this, "Square", Toast.LENGTH_SHORT);
    toast.show();
}