2016-07-03 5 views
0

내 onCreate 메소드에 추가했습니다.화면 방향 변경 핸들

setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

이제 어떤 측면 사용자가 전화를 돌리려고하는지 확인하고 싶습니다. 어떻게해야합니까?

사용자는 화면을 회전 할 수 없지만 그가 시도하는 날씨를 결정하려고합니다.

답변

0

사용이 :

Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); 
int rotation = display.getRotation(); 

난 당신이 도움을 생각 : how to detect orientation of android device?

+0

죄송합니다, 그것은 도움이되지 않습니다 –

0

확인이 밖으로

this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE