My app has a single Activity with a FragmentPagerAdapter with four fragments (Using the ViewPagerIndicator library). One of these fragments has designs for both a separate p
Write some code in AndroidManifest.xml on the particular activity tag.
android:configChanges="orientation|screenSize".
And Write code in Fragment on onCreateView method,
for Portrait:
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setRetainInstance(true);
for Landscape:
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setRetainInstance(true);