I am a beginner to Android App Development. I am creating a Code Editor app (that would allow developers to edit and run their html files) by using Java along with html, css and javascript (via WebView). I could easily accomplish the edit part but the problem is with executing any html file.
My first try was to use iframe with a src pointing directly to the file in sdcard-
<iframe src="file:///storage/emulated/0/<file-name>.html"></iframe>
But with this code, the problem is that the app immediately crashes when this iframe loads. Not only iframes any kind of request sent to a route in sdcard from the webview immediately crashes the app.
I find various solutions on internet but they all just add a JavascriptInterface that can be used to display images on webview. But that's not the case with me as you know the code that I want to execute is dynamic and must be able to access any kind of file that is accessible to a html file in a normal browser and also that the entire sdcard, though can be referenced in html codes, cannot be copied to assets folder. With these circumstances, all answers on internet are no helpful for me.
Summary- I want to view the output of any html code, stored in sdcard of users, in such a way that the output appears similar to what it would in a browser, that is by using Java and WebView Please help.
Edit- I want the solution to be by use of a iframe, which can be completely accessible to entire WebView.