How do I get the CURRENT orientation (ActivityInfo.SCREEN_ORIENTATION_*) of an Android device?

后端 未结 8 1992
隐瞒了意图╮
隐瞒了意图╮ 2020-11-27 03:05

I would like to find out the detailed orientation of a device, preferably one of SCREEN_ORIENTATION_LANDSCAPE, SCREEN_ORIENTATION_PORTRAIT, S

8条回答
  •  离开以前
    2020-11-27 03:18

    Simple approach would be to use

    getResources().getConfiguration().orientation
    

    1 is for Potrait and 2 for Landscape.

提交回复
热议问题