WindowManager mgr = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE));
int lastOrientation = mgr.getDefaultDisplay().getRotation();
activity.setRequestedOrientation(lastOrientation);
获得当前activity的屏幕方向,布布扣,bubuko.com
原文:http://www.cnblogs.com/chenlong-50954265/p/3924548.html