Load WebViewer from Document Directory?

File read / write seems to be recurring theme - but it seems with every 'upgrade' to Android the necessary approach changes. I can't find anything recently that covers my issue.
My app generates an HTML file which is saved to /Documents/savetest/filename.html using FileScope Legacy. I can then read that file back and display the HTML in a label field.
What I really want is to load the file into WebViewer but I cannot figure out the correct pathname syntax. I get an error message:The web page at file:///Documents/savetest/filename.html could not be located because: ERR_FILE_NOT_FOUND.
However if I put the HTML file in Media (Assets) it loads using http://localhost/filename.html and displays in WebViewer. (Some of the rendering is not correct, but I suspect that is a "style" issue)
Placing files in Assets is static, so not really a solution, hence the need to generate the HTML and save it somewhere but then read it back into WebViewer. But what is the correct pathname for that approach? Meantime writing to /Documents/.. is convenient as I can then inspect the HTML for debugging, but is there any better locatation for the final app when completed?
For info I've attached an image of the webview load block.

The correct path is file:///storage/emulated/0/Documents/savetest/filename.html

Taifun

Inside your app in the ASD - application specific storage would be the better location

Just use file scope App to store the file in the ASD
EDIT: see here how to get the full path to ASD

Taifun

1 Like

Thanks Taifun. It's kind of late here, but I'll work on your suggestions tomorrow. I should probably write the code so that I can select between using say /Documents/... or a temporary file in ASD.

Here's how to do it instream, with no files:

Concerning the incomplete display, the Web Viewer isn't a full browser, it's a subset. However, the extension Custom Web View should make life a lot better: