[android-developers] Re: Display locally stored html webpage using webview

2010-01-14 Thread tikky
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 
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 
> >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? 
>
> >>  >I tried the following too:
> >>  >
> >>  >
> >>  >..
> >>  >but nothing worked.
>
> >>  >On Jan 14, 2:26 pm, tikky  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 
> >>  >>  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  wrote:
>
> >>  >>  > > Hello,
>
> >>  >>  > > I have a locally stored webpage (html) under res/raw
> >>folder. The html
> >>  >>  > > is something like this:
>
> >>  >>  > > 
> >>  >>  > >    
> >>  >>  > >        This is a test page
> >>  >>  > >        
> >>  >>  > >        
> >>  >>  > >    
> >>  >>  > > 
>
> >>  >>  > > 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

[android-developers] Re: Display locally stored html webpage using webview

2010-01-14 Thread Jason Proctor
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 
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? 

 >I tried the following too:
 >
 >
 >..
 >but nothing worked.

 >On Jan 14, 2:26 pm, tikky  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 
 >>  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  wrote:

 >>  > > Hello,

 >>  > > I have a locally stored webpage (html) under res/raw 
folder. The html

 >>  > > is something like this:

 >>  > > 
 >>  > >
 >>  > >This is a test page
 >>  > >
 >>  > >
 >>  > >
 >>  > > 

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

[android-developers] Re: Display locally stored html webpage using webview

2010-01-14 Thread tikky
Nope, that does not work either.

On Jan 14, 2:50 pm, Jason Proctor 
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? 
>
> >I tried the following too:
> >
> >
> >..
> >but nothing worked.
>
> >On Jan 14, 2:26 pm, tikky  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 
> >>  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  wrote:
>
> >>  > > Hello,
>
> >>  > > I have a locally stored webpage (html) under res/raw folder. The html
> >>  > > is something like this:
>
> >>  > > 
> >>  > >    
> >>  > >        This is a test page
> >>  > >        
> >>  > >        
> >>  > >    
> >>  > > 
>
> >>  > > 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

[android-developers] Re: Display locally stored html webpage using webview

2010-01-14 Thread Jason Proctor
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? 

I tried the following too:


..
but nothing worked.


On Jan 14, 2:26 pm, tikky  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 
 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  wrote:

 > > Hello,

 > > I have a locally stored webpage (html) under res/raw folder. The html
 > > is something like this:

 > > 
 > >
 > >This is a test page
 > >
 > >
 > >
 > > 

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

[android-developers] Re: Display locally stored html webpage using webview

2010-01-14 Thread tikky
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? 

I tried the following too:


..
but nothing worked.


On Jan 14, 2:26 pm, tikky  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 
> 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  wrote:
>
> > > Hello,
>
> > > I have a locally stored webpage (html) under res/raw folder. The html
> > > is something like this:
>
> > > 
> > >    
> > >        This is a test page
> > >        
> > >        
> > >    
> > > 
>
> > > 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

[android-developers] Re: Display locally stored html webpage using webview

2010-01-14 Thread tikky
Thanks Guitouille. In that case, what URL string do I give to
webview's loadUrl(url) method?

On Jan 14, 11:29 am, Guitouille 
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  wrote:
>
> > Hello,
>
> > I have a locally stored webpage (html) under res/raw folder. The html
> > is something like this:
>
> > 
> >    
> >        This is a test page
> >        
> >        
> >    
> > 
>
> > 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

[android-developers] Re: Display locally stored html webpage using webview

2010-01-14 Thread Guitouille
Hello,

In order to do that, you have to put your html and gif file in the
assets directory.

Guitouille

On 14 jan, 16:42, tikky  wrote:
> Hello,
>
> I have a locally stored webpage (html) under res/raw folder. The html
> is something like this:
>
> 
>    
>        This is a test page
>        
>        
>    
> 
>
> 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

[android-developers] Re: Display locally stored html webpage using webview

2010-01-14 Thread Guitouille
And because I have read your question too fast, you have to put your
html file in the assets directory too

Guitouille

On 14 jan, 16:42, tikky  wrote:
> Hello,
>
> I have a locally stored webpage (html) under res/raw folder. The html
> is something like this:
>
> 
>    
>        This is a test page
>        
>        
>    
> 
>
> 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