In the following code, main xml file activity_main.xml is not used. What should be modified if I want to use it. The main intention is to load the webview in background while showing splashscreen on the front. Is my approach correct? If I want to use AsyncTask to load webview while showing splashscreen, what should I do? My app is loading everytime while changing the orientation. what should I do in order to fix it?
public class MainActivity extends Activity {
WebView webview;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    webview = new WebView(MainActivity.this);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.getSettings().setLoadsImagesAutomatically(true);
    webview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    webview.getSettings().setAppCacheEnabled(false);
    webview.loadUrl("http://www.nricabs.com");
    webview.setWebViewClient(new WebViewClient(){
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if(url.startsWith("tel:")) { 
                Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(url));
                startActivity(intent); 
                return true;
            }
            return false;
        }
        public void onPageFinished(WebView view,String url){
            super.onPageFinished(view, url);
            setContentView(webview);
        }
    }
            );
}
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if(event.getAction() == KeyEvent.ACTION_DOWN){
        switch(keyCode)
        {
        case KeyEvent.KEYCODE_BACK:
            if(webview.canGoBack()){
                webview.goBack();
            }else{
                finish();
            }
            return true;
        }
    }
    return super.onKeyDown(keyCode, event);
}
}
 
     
     
    