In his Fragment call inside onResume to lock the portrait:
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
then in onPause to unlock the orientation:
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
OBS! To do this, use if(getActivity != null) before using these methods.
source share