AmirG AmirG - 1 year ago 77
Android Question

Webview is opening also the browser

Hello i used a webview to show a gif animation of a logo but in some phones with 4.0 - 4.2 SO if i touch the gif when coming from onresume it opens the browser in a blank page. and i cannot go into app till i close it. Why is this happening ?

webViewSplash.setBackgroundColor(getColorResource(R.color.Transparent)); -> {
try {
webViewSplash.loadDataWithBaseURL("file:///android_asset/", "<html style=\"margin: 0;\"> "
+ "<body style=\"margin: 0;\"><img src=\"data:image/gif;base64,"
+ Base64.encodeToString(Functions.readBytes(getResources()
.openRawResource(R.drawable.splash_animation)), Base64.DEFAULT)
+ "\" style=\"width: 100%; height: 100%\" /> </body></html>",
"text/html", BuildConfig.DEFAULT_CHARSET, null);
} catch (Exception ex) {


Answer Source


Using myWebView.setWebViewClient(new WebViewClient()); worked. Thanksto @JonasCz and @SnildDolkow

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download