johns4ta
johns4ta

Reputation: 896

Accessing files stored in emulated storage

I currently have an application that downloads files from a server and by default they are stored under /storage/emulated/0/ . I set it up so they download to a folder called "data". The files successfully download and unzip to /storage/emulated/0/data/unzipped , however, when I try to load an html file, stored under the data folder, into a webview, I get an error saying the file can't be found. I double checked the file path of the html file using Astro File Manager and was able to verify I have the right file path. Here is the statement I use to load the html file into the webview.

wb.loadUrl(Environment.getExternalStorageDirectory()
                + "/data/unzipped/output.html");

I have tried it with and without the .html extension and still no luck. Any ideas? Are there are restrictions on accessing the emulated storage?

Upvotes: 0

Views: 6474

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006539

File paths are not URLs. Use the file:// scheme to access files.

Upvotes: 5

Related Questions