title: XML Splash Screen -> Display Webview
body: <p>Thanks for trying to solve my problem!</p>
  
  <p>Currently my app basically loads a web page using the Android Web view. The downside is that sometimes (with a bad connection) the web page takes over 10 seconds to load. Is there a way I can create some sort of splash XML "loading" screen while the web page is loading?</p>
  
  <p>Take a look at my code...</p>
  
  <pre><code>package com.ect;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.Window;
  import android.webkit.CookieSyncManager;
  import android.webkit.WebChromeClient;
  import android.webkit.WebView;
  import android.webkit.WebViewClient;
  import android.widget.Toast;
  
  public class SomeActivity extends Activity {
  
      /** Called when the activity is first created. */
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          //THIS IS WHAT I WANT: setContentView(R.layout.main);
  
          CookieSyncManager.createInstance(getBaseContext());
  
          // Let's display the progress in the activity title bar, like the
          // browser app does.
  
  
          getWindow().requestFeature(Window.FEATURE_PROGRESS);
  
          WebView webview = new WebView(this);
          setContentView(webview);
  
  
          webview.getSettings().setJavaScriptEnabled(true);
  
          final Activity activity = this;
          webview.setWebChromeClient(new WebChromeClient() {
          public void onProgressChanged(WebView view, int progress) {
               // Activities and WebViews measure progress with different scales.
               // The progress meter will automatically disappear when we reach 100%
               activity.setProgress(progress * 1000);
          }
        });
  
  webview.setWebViewClient(new WebViewClient() {
  
  public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
          //Users will be notified in case there's an error (i.e. no internet connection)
          Toast.makeText(activity, "Oh no! " + description, Toast.LENGTH_SHORT).show();
  }
  
  public void onPageFinished(WebView view, String url) {
      CookieSyncManager.getInstance().sync();
  }
  });
  
  CookieSyncManager.getInstance().startSync();
  CookieSyncManager.getInstance().sync();
  
       //This will load the webpage that we want to see
        webview.loadUrl("http://www.web.com/");
  
     }
  }
  </code></pre>
  
  <p>That is my code. If you look closely I made a comment that says, "THIS IS WHAT I WANT: ..."</p>
  
  <p>That comment would call the main.xml file to be displayed, but if I use that comment the main.xml file will be displayed, but the webview never appears...</p>
  
  <p><strong>How can I display the main.xml file and then (once the the web view loads) display the webpage?</strong></p>