How to display a local file in the browser?

1) For “static” files, you can use R class and use the browser to
render them
2) For runtime-generated files or “out-of-resouces” class, you can’t
use file:// URIs anymore
2)a) A possible solution: manually open the file and provide file
content as string, mimetype and encoding
2)a)issue) WebView must be used calling loadData method, which doesn’t
allow load content from network (so you can’t make it render external
images)
2)b) Another possible solution: create a content provider which
returns file content, mimetype and encoding by accessing a content://
URI. Theorically you can use WebView calling loadUrl method, which
renders the page correctly

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.