My app needs to be in portrait mode so I set it in the manifest by:
android:screenOrientation=\"portrait\"
But I just recently added anothe
This is old question but answering this just incase anyone wanted the solution as the OP needed. The simple way to achieve this is as follows.
public class LandscapeFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
getActivity().setRequestedOrientation(
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
@Override
public View onDestroyView() {
super.onDestroyView();
getActivity().setRequestedOrientation(
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
Then extend this LandscapeFragment from any of your fragment to which you want to launch it in landscape mode.