katre wrote:
> I initially assumed I could create a WebView and use that to display
> my HTML, but there seems to be no way to also pass in the style and
> image resources.  Some posts I saw suggested creating a
> ContentProvider, but this has a few problems for me:
> a) security: I want to keep all the data inside this app.  There's no
> need for a ContentProvider if I don't want other apps using the
> content, right?

You might be able to use permissions to manage this, but I'm not sure.

Or, if you unpack some or all of your ZIP file, you can use relative
paths in the HTML to reference the images and CSS, and use
loadDataWithBaseURL() and a fake base URL (e.g.,
fake://i/get/really/tired/of/typing/these/in) to load it, thereby
skipping the ContentProvider outright.

> b) files: The ContentProvider's openFile() method returns a
> ParcelFileDescriptor, which can only be created from a Socket or a
> File.  I have neither, I have an InputStream.  So it seems there's no
> way to return the image and style data from a ContentProvider anyway.

If you don't want to unpack the whole ZIP file, unpack only those pieces
you need, as you need them. Create yourself a cache directory, unpack
them there, and clean it up periodically.

> This seems like an obvious problem, so I hope there is some obvious
> problem I'm missing.  Or is there really no way to display non-
> network, non-file HTML data in my app?

I suspect that the most-frequently-used patterns for Web browsing
components are to display either network-served content or regular local
files.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com

Android Training on the Ranch! -- Mar 16-20, 2009
http://www.bignerdranch.com/schedule.shtml

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to