ActionBar nullpointerexception eventhough it exists and has proper id in a fragment

Error

FATAL EXCEPTION: main
                                                                           Process: com.appmaster.akash.messageplus, PID: 2627
                                                                           java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.hide()' on a null object reference
                                                                               at com.appmaster.akash.messageplus.HomeScreen_Profile.onCreateView(HomeScreen_Profile.java:37)
                                                                               at android.support.v4.app.Fragment.performCreateView(Fragment.java:2354)
                                                                               at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1419)
                                                                               at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)
                                                                               at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)
                                                                               at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:799)
                                                                               at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2580)
                                                                               at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2367)
                                                                               at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2322)
                                                                               at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2199)
                                                                               at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:651)
                                                                               at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:145)
                                                                               at android.support.v4.view.ViewPager.populate(ViewPager.java:1236)
                                                                               at android.support.v4.view.ViewPager.populate(ViewPager.java:1084)
                                                                               at android.support.v4.view.ViewPager$3.run(ViewPager.java:267)
                                                                               at android.view.Choreographer$CallbackRecord.run(Choreographer.java:860)
                                                                               at android.view.Choreographer.doCallbacks(Choreographer.java:672)
                                                                               at android.view.Choreographer.doFrame(Choreographer.java:605)
                                                                               at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:846)
                                                                               at android.os.Handler.handleCallback(Handler.java:742)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                               at android.os.Looper.loop(Looper.java:157)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5571)
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)

XML

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
    android:id="@+id/app_bar_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:contentScrim="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <ImageView
            android:src="@drawable/profilepic"
            android:id="@+id/profilePic"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scaleType="centerCrop"
            app:layout_collapseMode="parallax"
            app:layout_collapseParallaxMultiplier="0.7" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin">


        </android.support.v7.widget.Toolbar>
    </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">


    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/a"
        android:gravity="center_horizontal"
        android:orientation="vertical">

        <TextView
            android:id="@+id/name"
            android:layout_width="70dp"
            android:layout_height="30dp"
            android:layout_marginTop="12dp"
            android:text="Name"
            android:textColor="@color/white"
            android:textSize="20dp" />

        <TextView
            android:id="@+id/status"
            android:layout_width="70dp"
            android:layout_height="30dp"
            android:layout_marginTop="45dp"
            android:text="Status"
            android:textColor="@color/silver"
            android:textSize="20dp" />

        <TextView
            android:id="@+id/email"
            android:layout_width="70dp"
            android:layout_height="30dp"
            android:layout_marginTop="21dp"
            android:text="Email"
            android:textSize="20dp" />

        <TextView
            android:id="@+id/quote"
            android:layout_width="70dp"
            android:layout_height="30dp"
            android:layout_marginTop="27dp"
            android:text="Quote"
            android:textSize="20dp" />

        <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Number"
            android:textSize="20dp" />

    </LinearLayout>

</android.support.v4.widget.NestedScrollView>

Java

public class HomeScreen_Profile extends Fragment {
View rootView;
EditText Email, Status, Quote, Number;
private FirebaseAuth mAuth;
String uid;
Toolbar toolbar;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.fragment_profile, container, false);
    toolbar = (Toolbar)getActivity().findViewById(R.id.toolbar);
    ((AppCompatActivity)getActivity()).getSupportActionBar().hide();

    mAuth = FirebaseAuth.getInstance();

The line where I'm getting error is on the line ((AppCompatActivity)getActivity()).getSupportActionBar().hide();

I've been trying to hide my toolbar in a fragment but not succeeding.