I am referring to this video tutorial here ---- CLICK HERE
I the video the speaker is using a code below
He is using dynamic way of dealing with fragments
MainActivity.java
package com.example.simpledynamicfragment;
import android.os.Bundle;
import android.app.Activity;
import android.support.v4.app.FragmentManager;
import android.app.Fragment;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentActivity frag=new FragmentActivity();
FragmentManager FM = getSupportFragmentManager();
}
}
I am getting the error at line ::
FragmentManager FM = getSupportFragmentManager();
- I know we need to extend fragment class but in the video the speaker uses extending the activity. How is he accomplishing the task without encountering errors.
Or
- am i doing the mistake
Note:: I am using support package for fragments
ERROR:: The method getSupportFragmentManager() is undefined for the type MainActivity
How to clarify & clear my doubts .... Any guidance would e helpful