Hi Jason,

It works now. The issue was the I was loading the webview using:
    loadData(htmlData, mimetype, encoding);

When I changed it to :
loadUrl("file:///android_asset/test.html");

everything started working fine :)

Thanks for all the help.

On Jan 14, 3:37 pm, Jason Proctor <jason.android.li...@gmail.com>
wrote:
> ISTR a new permission that came in with 1.5 or 1.6 that was required
> for this. sorry i don't remember which one it is. do you perhaps not
> have it set?
>
> another way around this i found to work is to write a simple content
> provider which effectively caches assets in the filesystem, and
> returns references to them via (and only) openFile(). leave the cache
> extant as long as you like. this way you can put content: URLs in
> your HTML and have stuff that doesn't change very often (3rd party
> Javascript, etc) in your apk.
>
> but i've never understood why this is such an ordeal. the app is
> asking webkit to load resources which the author of the app packaged
> into the apk. what's the problem??
>
>
>
> >Nope, that does not work either.
>
> >On Jan 14, 2:50 pm, Jason Proctor <jason.android.li...@gmail.com>
> >wrote:
> >>  it's in the deep past for me and i can't remember how much success i
> >>  had with this approach, but try URLs of the form --
>
> >>  file:///android_asset/test.gif
>
> >>  accessing local files from webkit was a mess way back when, i've not
> >>  looked into it recently so i can't tell whether it's been fixed up.
>
> >>  >Guitouille,
> >>  >I was able to load the html file using AssetManager and the web page
> >>  >loads as expected, but the image file is still not displayed.
> >>  >Is this the correct syntax? <img src="test.gif"></img>
>
> >>  >I tried the following too:
> >>  ><img src="file://test.gif"></img>
> >>  ><img src="file:///test.gif"></img>
> >>  >..
> >>  >but nothing worked.
>
> >>  >On Jan 14, 2:26 pm, tikky <tiku...@gmail.com> wrote:
> >>  >>  Thanks Guitouille. In that case, what URL string do I give to
> >>  >>  webview's loadUrl(url) method?
>
> >>  >>  On Jan 14, 11:29 am, Guitouille <guillaume.lardill...@gmail.com>
> >>  >>  wrote:
>
> >>  >>  > In fact your test.gif has to be in the assets folder in order to be
> >>  >>  > visible.
>
> >>  >>  > Guitouille
>
> >>  >>  > On 14 jan, 16:42, tikky <tiku...@gmail.com> wrote:
>
> >>  >>  > > Hello,
>
> >>  >>  > > I have a locally stored webpage (html) under res/raw
> >>folder. The html
> >>  >>  > > is something like this:
>
> >>  >>  > > <html>
> >>  >>  > >    <body>
> >>  >>  > >        This is a test page
> >>  >>  > >        <br></br>
> >>  >>  > >        <img src="test.gif"></img>
> >>  >>  > >    </body>
> >>  >>  > > </html>
>
> >>  >>  > > There is an image that is referenced in this html page (test.gif)
> >>  >>  > > which is stored under res/drawables.
>
> >>  >>  > > When I use a webview to display this page, it does not display the
> >>  >>  > > image. How can I correctly reference the path to the test.gif 
> >> image?
>
> >>  >>  > > I tried using a text view with Html.fromHtml() but that
> >>does not parse
> >>  >>  > > several html tags.
>
> >>  >>  > > Any help on this issue will be greatly appreciated.
>
> >>  >--
> >>  >You received this message because you are subscribed to the Google
> >>  >Groups "Android Developers" group.
> >>  >To post to this group, send email to android-developers@googlegroups.com
> >>  >To unsubscribe from this group, send email to
> >>  >android-developers+unsubscr...@googlegroups.com
> >>  >For more options, visit this group at
> >>  >http://groups.google.com/group/android-developers?hl=en
>
> >>  --
> >>  jason.vp.engineering.particle
>
> >--
> >You received this message because you are subscribed to the Google
> >Groups "Android Developers" group.
> >To post to this group, send email to android-developers@googlegroups.com
> >To unsubscribe from this group, send email to
> >android-developers+unsubscr...@googlegroups.com
> >For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> jason.vp.engineering.particle
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to