title: How to resolve the white Screen of WebView?
body: <p>I'm using the below code to populate my <code>WebView</code> with local html files, but it appears fine in some device but recently I noticed in some Device like <em><code>Colors X114</code></em>, the <code>WebView</code> appears fine for one Second and then everything disappears and white blank screen appears.  </p>
  
  <h3>The Code:</h3>
  
  <pre><code>package com.nepalpolice.mnemonics;
  
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.support.v7.app.AppCompatActivity;
  import android.view.KeyEvent;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.ViewGroup;
  import android.webkit.WebSettings;
  import android.webkit.WebView;
  import android.webkit.WebViewClient;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.LinearLayout;
  
  
  /**
   * Created by Sagar on 2017/09/23. yo chai menupage ko Fragments ko lagi
   */
  
  public class Homepage extends Fragment {
  
      WebView myWebView;
      private LinearLayout container;
      private Button nextButton, closeButton;
      private EditText findBox;
  
  
      public Homepage() {
          // Required empty public constructor
      }
  
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          View rootView = inflater.inflate(R.layout.fragment_homepage, container,  false);
  
  
          String url = getArguments().getString("url");
  
  
          myWebView=(WebView)rootView.findViewById(R.id.webview);
          myWebView.getSettings().setBuiltInZoomControls(true);
  
          myWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
          myWebView.getSettings().setLoadsImagesAutomatically(true);
          myWebView.getSettings().setJavaScriptEnabled(true);
  
          myWebView.getSettings().setBuiltInZoomControls(true);
  
          myWebView.setInitialScale(1);
          myWebView.getSettings().setLoadWithOverviewMode(true);
          myWebView.getSettings().setUseWideViewPort(true);
  
          WebSettings webSettings = myWebView.getSettings();
  
          myWebView.loadUrl(url);
  
  
          return rootView;
  
  
      }
  
      public static String changedHeaderHtml(String htmlText) {
  
          String head = "&lt;head&gt;&lt;meta name=\"viewport\" content=\"width=device-width, user-scalable=yes\" /&gt;&lt;/head&gt;";
  
          String closedTag = "&lt;/body&gt;&lt;/html&gt;";
          String changeFontHtml = head + htmlText + closedTag;
          return changeFontHtml;
  
      }
  }
  </code></pre>
  
  <p>and this is how it appears or should appears</p>
  
  <p><a href="https://i.stack.imgur.com/DDx8h.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DDx8h.jpg" alt="enter image description here"></a></p>
  
  <p>But how it appears in some Device.</p>
  
  <p><a href="https://i.stack.imgur.com/gfy5j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gfy5j.png" alt="enter image description here"></a></p>
  
  <p>and I'm passing the url as string as below</p>
  
  <pre><code>  args3.putString("url1", "file:///android_asset/b/dbpm.html");
  </code></pre>