Displaying offline webpages from sdcard

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Displaying offline webpages from sdcard

Postby finucas » Tue Jul 13, 2010 4:35 pm

Hi,
Im currently developing my first major Android project,

One of the aims is display offline webpages after other navigations and views are completed.

Instead of parsing an entire html file and creating a custom view to display it
i am wondering if android now offers a way to open up a html page which resides on the sdcard,
I have came across someone mentioning it is now possible with 2.1, file://sdcaard etc..

Can someone confirm this please and if possible provide a line of code in which the default broswer can be launched within an app giving a supplied local url which resides on the sdcard.

Thanks in advance.

Sean.
finucas
Freshman
Freshman
 
Posts: 6
Joined: Tue Jul 13, 2010 4:26 pm

Top

Re: Displaying offline webpages from sdcard

Postby ykatchou » Thu Jul 22, 2010 2:49 pm

Android seems using URI for everything, so you can easily watch html file also. You juste have to build the good URI.

Enjoy'
ykatchou
Once Poster
Once Poster
 
Posts: 1
Joined: Mon May 31, 2010 1:41 pm

Re: Displaying offline webpages from sdcard

Postby finucas » Mon Jul 26, 2010 2:12 pm

I have sorted this out,

You can now feed in the file name of any offline page say stored on your sdcard, you can also
pass in strings containing html code to display with androids webview.

Note when passing in your own strings with webview.loadData this will not diaply images, i.e <img src =
to get by this you can use loadDataWithBaseURL and feed in a false uri, dont ask why i found a solution but not
why this has to be done, i think its something to do with base64 encoding.
finucas
Freshman
Freshman
 
Posts: 6
Joined: Tue Jul 13, 2010 4:26 pm

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 9 guests