Android How to - Is Context LandScape








Question

We would like to know how to is Context LandScape.

Answer

/*from ww w .  j a v a2  s. co m*/
import android.content.Context;
import android.content.res.Configuration;

public class Main {
  public static boolean isLandScape(Context context) {
    return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
  }

}