title: Load webview while splash screen is active?
body: <p>I would like to load my webview while splash screen is active?
  This is more of a visual thing than a direct issue, but when a WebView loads in my application, the screen is blank white for between 2-4 seconds until the content is fully loaded. The time is dependent on the size of content that is loading.
  Can somebody help me?</p>
  
  <p>This is MainActivity   </p>
  
  <pre><code>   public class MainActivity extends Activity
  
  {
  
      private static final String MIME_TYPE_EMAIL = null;
      final Activity activity = this;
  
      @SuppressWarnings("deprecation")
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
  
          this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
          setContentView(R.layout.activity_main);
          webView = (WebView) findViewById(R.id.webview);
          webView.getSettings().setJavaScriptEnabled(true);
          webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
          webView.getSettings().setPluginsEnabled(true);
          webView.setWebChromeClient(new WebChromeClient()); 
          String scandinavianCharacters = null;
          webView.loadDataWithBaseURL(null, scandinavianCharacters, "text/html", "UTF-8", null);
          webView.getSettings().setUserAgentString("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)");
          webView.setWebChromeClient(new WebChromeClient() {
  
  
              public void onProgressChanged(WebView view, int progress)
              {
                  activity.setTitle("Učitavanje...");
                  activity.setProgress(progress * 100);
  
                  if(progress == 100)
                      activity.setTitle(R.string.app_name);
              }
          });
  
          webView.setWebViewClient(new WebViewClient() {
              @Override
              public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
              {
                  try {
                      webView.stopLoading();
                  } catch (Exception e) {
                  }
                  try {
                      webView.clearView();
                  } catch (Exception e) {
                  }
                  if (webView.canGoBack()) {
                      webView.goBack();
                  }
                  webView.loadUrl("file:///android_asset/greska/greska.html");
                  super.onReceivedError(webView, errorCode, description, failingUrl);
              }
  
              @Override
              public boolean shouldOverrideUrlLoading(WebView view, String url)
              {
                  view.loadUrl(url);
                  return true;
              }
          });
  
          webView.loadUrl("http://mysite.com");
  
      }
      public boolean shouldOverrideUrlLoading(WebView webview, String url)
      { 
          webview.loadUrl(url);
          return true;
      }
  
  
      WebView webView;
      @Override
      public void onBackPressed (){
  
          if (webView.isFocused() &amp;&amp; webView.canGoBack()) {
                  webView.goBack();       
          }
          else {
                  super.onBackPressed();
          }
      }
      public boolean shouldOverrideUrlLoading(webView view, String url) {
          if(url.startsWith("mailto:")){
              MailTo mt = MailTo.parse(url);
              Intent i = IntentSupport.newEmailIntent(MainActivity.this, mt.getTo(), mt.getSubject(), mt.getBody(), mt.getCc());
              startActivity(i);
              view.reload();
              return true;
          }
  
              else{
                  view.loadUrl(url);
              }
              return true;
          }
     ;
  
  
  public static Intent newEmailIntent(Context context, String address, String subject, String body, String cc) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] { address });
    intent.putExtra(Intent.EXTRA_TEXT, body);
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    intent.putExtra(Intent.EXTRA_CC, cc);
    intent.setType(MIME_TYPE_EMAIL);
    return intent;
  }
      }
  </code></pre>
  
  <p>This is splash activity</p>
  
  <pre><code>public class SplashActivity extends Activity {
  
     private static String TAG = SplashActivity.class.getName();
     private static long SLEEP_TIME = 8;    // Sleep for some time
  
     @Override
     protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
  
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);    // Removes title bar
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);    // Removes notification bar
  
        setContentView(R.layout.splash);
  
        // Start timer and launch main activity
        IntentLauncher launcher = new IntentLauncher();
        launcher.start();
     }
  
     private class IntentLauncher extends Thread {
        @Override
        /**
         * Sleep for some time and than start new activity.
         */
        public void run() {
           try {
              // Sleeping
              Thread.sleep(SLEEP_TIME*1000);
           } catch (Exception e) {
              Log.e(TAG, e.getMessage());
           }
  
           // Start main activity
           Intent intent = new Intent(SplashActivity.this, MainActivity.class);
           SplashActivity.this.startActivity(intent);
           SplashActivity.this.finish();
        }
     }
  }
  </code></pre>
  
  <p>Manifest file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.emirnp"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="17" /&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:hardwareAccelerated="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@android:style/Theme.NoTitleBar" &gt;
          &lt;activity
              android:name="com.emirnp.next.press.SplashActivity"&gt;
          &lt;intent-filter&gt;
               &lt;action android:name="android.intent.action.MAIN" /&gt;
               &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
                &lt;/intent-filter&gt;
                &lt;/activity&gt;
          &lt;activity
  
              android:name="com.emirnp.next.press.MainActivity"
              android:configChanges="keyboardHidden|orientation|screenSize"
              android:screenOrientation="portrait" 
              android:hardwareAccelerated="true"&gt;
              &lt;intent-filter&gt;
                 &lt;action android:name="android.intent.action.MAIN" /&gt;
  &lt;/intent-filter&gt;
  
  
          &lt;/activity&gt;
  
      &lt;/application&gt;
  
  &lt;/manifest&gt;    
  </code></pre>