The project is using webviews to display html content which have been downloaded from a server as a json file (the html content is part of that json file). Each html includes text, images and urls. The problem is that the images are using quite a lot of memory currently (up to 70mb for just one image).
I have read that this behavior can be "fixed" by downloading the image outside from the webview, reducing it's size and replacing the src tag using the local file path. I'm currently using Glide inside my project. My question is now if anyone can explain me the reason behind the webviews behavior and the best approach using Glide for that.
By calling the following methods, I was able to reduce the memory usage of my webview (100mb down to 50-60mb):
webView.getSettings().setAllowFileAccess(true);
webView.getSettings().setAppCacheEnabled(true);
webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
Maybe someone else has an idea to reduce that even more.
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