Attempt to invoke virtual method 'void android.webkit.WebView.setWebViewClient()' on a null object reference while using webview in fragment Class
<p>Iam Creating Project for "Drawerwith Swipe Tab " in that i was using a webview in fragment Class , but while Running App its getting getting Crash with a error in log cat, Still getting error </p>

<p><strong>Attempt to invoke virtual method 'void android.webkit.WebView.setWebViewClient()' on a null object reference</strong> </p>

<p><strong>Fragment Class :</strong></p>

<pre><code>  package com.androidbelieve.drawerwithswipetabs;

  import android.graphics.Bitmap;
  import android.graphics.Color;
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.webkit.WebView;
  import android.webkit.WebViewClient;
  import android.widget.ProgressBar;

public class SocialFragment extends Fragment {


ProgressBar pb_per;
WebView mWebView;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    pb_per = (ProgressBar) container.findViewById(R.id.progressBar_book1);
    mWebView = (WebView) container.findViewById(R.id.web_book1); //This is the id you gave for webview

    //------------------------------------- to over ride keyboard error ------------(1)
    mWebView.setWebViewClient(new myWebClient());
    mWebView.getSettings().setJavaScriptEnabled(true);
    //----------------------------------------------------------------------------


    mWebView.getSettings().setSupportZoom(true);       //Zoom Control on web (You don't need this
    //if ROM supports Multi-Touch
    mWebView.getSettings().setBuiltInZoomControls(true); //Enable Multitouch if supported by ROM
    mWebView.setBackgroundColor(Color.parseColor("#FFFFFF"));
    mWebView.getSettings().setUseWideViewPort(true);
    mWebView.getSettings().setLoadWithOverviewMode(false);


    // Load URL
    mWebView.loadUrl("http://m.tnstc.in");


    return inflater.inflate(R.layout.social_layout,null);
}

//================================= to over ride keyboard error (2)============================

public class myWebClient extends WebViewClient {
    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        // TODO Auto-generated method stub
        super.onPageStarted(view, url, favicon);
    }

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        // TODO Auto-generated method stub
             pb_per.setVisibility(View.VISIBLE);
        //  multi_per.setVisibility(ProgressBar.GONE);

        view.loadUrl(url);
        return true;

    }

    @Override
    public void onPageFinished(WebView view, String url) {
        // TODO Auto-generated method stub
        super.onPageFinished(view, url);
         pb_per.setVisibility(View.GONE);
        //  multi_per.setVisibility(ProgressBar.VISIBLE);

    }
 }
}
</code></pre>

<p><strong>XML Code for Fragment Class</strong> 
     </p>

<pre><code>  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical" android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
&lt;WebView
    android:id="@+id/web_book1"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentStart="false" 
    android:layout_alignParentEnd="true" /&gt;


   &lt;ProgressBar
    style="?android:attr/progressBarStyleLarge"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/progressBar_book1"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true" /&gt;

 &lt;/RelativeLayout&gt;
</code></pre>

<p><strong>LogCat Error :</strong></p>

<pre><code>-10 18:03:52.724 3534-3534/? W/BackgroundThrea: type=1400 audit(0.0:5504636): avc: denied { search } for name="31316" dev="proc" ino=3076117 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:system_app:s0 tclass=dir permissive=0
03-10 18:03:52.734 3534-3534/? W/BackgroundThrea: type=1400 audit(0.0:5504637): avc: denied { search } for name="32328" dev="proc" ino=2257596 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:bluetooth:s0 tclass=dir permissive=0
03-10 18:03:52.734 3534-3534/? W/BackgroundThrea: type=1400 audit(0.0:5504638): avc: denied { search } for name="32328" dev="proc" ino=2257596 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:bluetooth:s0 tclass=dir permissive=0
03-10 18:03:52.744 3534-3534/? W/BackgroundThrea: type=1400 audit(0.0:5504639): avc: denied { search } for name="32328" dev="proc" ino=2257596 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:bluetooth:s0 tclass=dir permissive=0
03-10 18:03:52.764 3534-3534/? W/BackgroundThrea: type=1400 audit(0.0:5504640): avc: denied { search } for name="1" dev="proc" ino=6152 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:init:s0 tclass=dir permissive=0
03-10 18:03:52.900 31372-31372/? D/AndroidRuntime: Shutting down VM
03-10 18:03:52.905 31372-31372/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: com.androidbelieve.drawerwithswipetabs, PID: 31372
                                                   Theme: themes:{default=overlay:system, iconPack:system, fontPkg:system, com.android.systemui=overlay:system, com.android.systemui.navbar=overlay:system}
                                                   java.lang.NullPointerException: Attempt to invoke virtual method 'void android.webkit.WebView.setWebViewClient(android.webkit.WebViewClient)' on a null object reference
                                                       at com.androidbelieve.drawerwithswipetabs.SocialFragment.onCreateView(SocialFragment.java:30)
                                                       at android.support.v4.app.Fragment.performCreateView(Fragment.java:1789)
                                                       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:955)
                                                       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
                                                       at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
                                                       at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
                                                       at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:490)
                                                       at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
                                                       at android.support.v4.view.ViewPager.populate(ViewPager.java:1105)
                                                       at android.support.v4.view.ViewPager.populate(ViewPager.java:951)
                                                       at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1473)
                                                       at android.view.View.measure(View.java:18797)
                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                                                       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
                                                       at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
                                                       at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
                                                       at android.view.View.measure(View.java:18797)
                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                                                       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
                                                       at android.view.View.measure(View.java:18797)
                                                       at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:868)
                                                       at android.view.View.measure(View.java:18797)
                                                       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
                                                       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
                                                       at android.view.View.measure(View.java:18797)
                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                                                       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
                                                       at android.support.v7.internal.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:124)
                                                       at android.view.View.measure(View.java:18797)
                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                                                       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
                                                       at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
                                                       at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
                                                       at android.view.View.measure(View.java:18797)
                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                                                       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
                                                       at android.view.View.measure(View.java:18797)
                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                                                       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
                                                       at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
                                                       at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
                                                       at android.view.View.measure(View.java:18797)
                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
                                                       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
                                                       at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2899)
                                                       at android.view.View.measure(View.java:18797)
                                                       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2100)
                                                       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1216)
                                                       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1452)
                                                       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
                                                       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
                                                       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
                                                    at android.view.Choreographer.doCall
03-10 18:03:52.976 791-2716/? W/ActivityManager:   Force finishing activity com.androidbelieve.drawerwithswipetabs/.MainActivity
03-10 18:03:52.982 791-1298/? W/SearchableInfo: Invalid searchable metadata for com.bt.bms/.activities.GlobalSearchActivity: Search label must be a resource reference.
03-10 18:03:53.214 791-2716/? W/ActivityManager:   Force finishing activity com.facebook.katana/.activity.ImmersiveActivity
03-10 18:03:53.221 791-1276/? W/art: Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12872 waiters=0 for 305ms
03-10 18:03:53.222 27217-27217/? D/AppStateLogger: Activity activity.ImmersiveActivity changed state to Stopped
03-10 18:03:53.232 27217-27259/? D/AppStateLogger: Successfully dumped app state to log file 
</code></pre>