I've display the splash screen, after finish the splah time , i start the next activity. In second activity i've webview. i load html file on webview.
My problem is , after closing splashscreen, black screen has come. after that only webview show.
How to avoid this.
i've used below code to load html file on webview .
webView.loadData(getString(R.string.termsofuse_content), "text/html", "utf-8");
This is because WebView takes some time to load the Data and until it does that you will be seeing a Black Screen or a empty screen.
To overcome this, you can use the WebViewClient and show a ProgressDialog until the WebView loads the data completely.
webview.setWebViewClient(new WebViewClient()
{
@Override
public void onPageFinished(WebView view, final String url) {
progressdialog.dismiss();
}
@Override
public void onPageStarted(WebView view, String url,
Bitmap favicon) {
progressdialog.show();
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With