AmirG AmirG - 8 months ago 33
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) {




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