how to use setSupportActionBar in fragment : <p>I need to use the setSupportActionBar in fragment which I am unable to also I am unable to use setContentView please to help with it also Thankyou in advance
the related code is given</p>

<pre><code>public class StudentrFragment extends Fragment {
        Toolbar toolbar;
        TabLayout tabLayout;
        ViewPager viewPager;
        ViewPagerAdapter viewPagerAdapter;


        public StudentrFragment() {
            // Required empty public constructor
        }


        @Override
        public void onCreate(Bundle savedInstanceState){
            super.onCreate(savedInstanceState);
            setContentView(R.layout.tabbar_layout);
            toolbar = (Toolbar) findViewById(R.id.toolbar);
            setSupportActionBar(toolbar); 
            tabLayout = (TabLayout) findViewById(R.id.tabLayout);
            viewPager = (ViewPager) findViewById(R.id.viewPager);
            viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
            viewPagerAdapter.addFragments(new CivilFragment(),"Civil Dept");
            viewPagerAdapter.addFragments(new ComputerFragment(),"CSE Dept");
            viewPagerAdapter.addFragments(new EeeFragment(),"EEE Dept");
            viewPagerAdapter.addFragments(new EceFragment(),"ECE Dept");
            viewPager.setAdapter(viewPagerAdapter);
            tabLayout.setupWithViewPager(viewPager);

        }

    }
</code></pre>
