title: How to reload fragment when button clicked
body: <p>I want to refresh fragment by clicking retry button in onCreateView.
  If my internet is disconnected it must return fragment_no_internet_error layout. There is a button to reload fragment.</p>
  <p>It gives me the error:</p>
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
      Process: ir.hamedanmelk.hamedanmelk, PID: 21310
      java.lang.NullPointerException: Attempt to read from field 'androidx.fragment.app.FragmentManager androidx.fragment.app.Fragment.mFragmentManager' on a null object reference
          at androidx.fragment.app.BackStackRecord.detach(BackStackRecord.java:220)
  </code></pre>
  <p>my OnCreateView:</p>
  <pre><code>@SuppressLint(&quot;SetJavaScriptEnabled&quot;)
  @Override
  public View onCreateView(LayoutInflater inflater, final ViewGroup container,
                           Bundle savedInstanceState) {
      // Inflate the layout for this fragment
      View v;
      CheckConnectivity checkConnectivity=new CheckConnectivity();
      if(!checkConnectivity.isNetworkAvailable(getActivity())) {
          v=inflater.inflate(R.layout.fragment_no_internet_error, container, false);
          Button retrybutton = (Button)v.findViewById(R.id.no_internet_fragment_button_retry);
          retrybutton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
                  Fragment frg = getActivity().getSupportFragmentManager().findFragmentById(R.id.HelpFragment);
                  final FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
                  ft.detach(frg);
                  ft.attach(frg);
                  ft.commit();
              }
          });
          return v;
      }
  
  
      v=inflater.inflate(R.layout.fragment_f_a_q, container, false);
      mwebview = (WebView) v.findViewById(R.id.webview_f_a_q);
      WebSettings webSettings=mwebview.getSettings();
      webSettings.setJavaScriptEnabled(true);
      final ProgressDialog progressDialog = new ProgressDialog(getActivity());
      //TODO Change FontFace https://stackoverflow.com/questions/3900658/how-to-change-font-face-of-webview-in-android
      mwebview.setWebViewClient(new WebViewClient(){
  
      return v;
   }
  }
  </code></pre>