Thanks Mark. I could use some advice on the best approach to this
problem....

The image that I am trying to display is very large and I want to
preserve its detail. So I am including it in the apk in the assets/
directory. My app almost exclusively uses WebView to display content.
I am trying to figure out the best way to show this large image from
one of the html pages loaded by my WebView.

1. Should I load it with my WebView? I thought I could use img tags
with urls like file:///android_asset/myimage.png. But this does not
seem to work.

2. Can I start a new Activity with an Intent that shows the image in
the default image viewer? This might be nice if it allows zooming and
scrolling. In this case, what is the URI I should use to an image in
my assets directory?

3. I can write my own Activity to load the image from my assets
directory. Does ImageView support zooming and scrolling?

Any advice on which of these approaches makes the most sense? Or is
there another approach that I am overlooking all together?

thanks,
Jeff

On May 12, 8:45 am, Mark Murphy <[email protected]> wrote:
> Jeff wrote:
> > Hello all,
> > I apologize if this is beating a dead horse, but I have been through
> > the documentation and groups discussions over and over, and can't seem
> > to resolve this issue....
>
> > What I want to do:
> > - I am loading a remote web page into WebView using loadUrl() -
> > example:  webView.loadUrl("http://myserver.com/page.html";);
> > - That page has a very large image in it whose quality I do not want
> > degraded by the OS. So I am putting it in the assets directory of the
> > app.
> > - The page.html that gets downloaded from my server, then has a
> > regular img tag in it like so:
> > <img src="file:///android_asset/largeimage.png"/>
>
> > I know there were some issues with reading assets from the file system
> > with different versions of the platform. But its not clear what
> > versions this affects and how to address the problem for all versions.
> > Can someone please clarify:
>
> > A) should what I am doing above work (because its not)
>
> Since you are loading the Web page from the Internet, I imagine WebView
> will block local file access. This is not significantly different than
> regular Web browsers, last I checked. Otherwise, Javascript could
> rummage around the local file system, grab data, and send it hither and
> proverbially yon.
>
> > B) If it only works on some versions of the platform - which versions?
> > How should this be addressed when I can't guarantee what version of
> > the platform users are running?
>
> Try creating a ContentProvider to serve the image, and see if you have
> better luck with a content:// URL.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _Android Programming Tutorials_ Version 2.0 Available!
>
> --
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
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