To solve this problem, follow the below-given steps −
For android versions less than 4.4, loading data into a webview with a file scheme as a directory like this won’t work.
browser.loadDataWithBaseUrl("file:///android_asset/", html, "text/html", "UTF-8", null);
Add a filename and it works on older Android versions −
browser.loadDataWithBaseUrl("file:///android_asset/new.html", htmlContent, "text/html", "UTF-8", null);
You can use the following too, in case your URL is https://www.demo.com −
browser.loadDataWithBaseURL("https://www.demo.com", htmlContent, "text/html", "utf-8", null);