I am working on a problem to fix Activity restart on screen rotation, I am implementing the 2nd part of this answer, it gives me the error in setContentView(R.layout.fragment_introduction).
The method setContentView(int) is undefined for the type IntroductionFragment.
public class IntroductionFragment extends Fragment {
public IntroductionFragment(){}
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container, Bundle savedInstanceState)
{
    View rootView = inflater.inflate(R.layout.fragment_introduction,container,false);
    return rootView;
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
  super.onConfigurationChanged(newConfig);
  setContentView(R.layout.fragment_introduction);
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.indianconstitution"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="18" />
<application
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.indianconstitution.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
</manifest>
How to fix this error?
Thanks in advance
 
     
     
    