09-16-2012 01:23 PM
Hi to all, bbDevelopers I'm going 2 graduate in university and i ll present a bb app;
I ve a problem: I create a server with my DB and the app connects to it to show the content;
i d create a if-else construct that:
(i ve a list of name, everyone with its relative URL)
-IF the user click for the FIRST time a specified name of the list, has it connected to the specified URL and show my "site";
then creates a pathfile where to save my html page (and content);************
-ELSE (if the user has already visited the specified url, previously) take the html page on local memory.
I hope U understand me
so..how can i save these content in local memory? is there a one easy method??
I pray U
09-17-2012 01:08 AM
What you are trying to do is easy in parts and not in others:
Firstly to get the content of a web page is easy, httpDemo sample app does that. Then top store it, you just write this a suitable file name on the SD Card. You would probably use a similar name to the page you downloaded. Writing the SD Card is little complicated, there are a number of samples around that do a little bit of this, so I would search the forum but you will have to work the code together yourself..
However that only gets the html. You then to parse the html and download all the embedded resources, like the images in the web page. It gets worse, you then have to change the html you have downloaded so that it references the resources you have downloaded on the SD Card rather than using the internet version.
Perhaps you should just do the 'first' http page, as it is probably the easiest thing to do.
Anyway the one final par of the program is displaying the page. For this you should use BrowserField2, there are many samples of that if you search here. So you program will be told a URL, you will check the SD Card to see if you have downloaded it, and if you have you will direct your Field to that location, otherwise you will direct the BrowserField2 to the web and at the same time, start a background process to download the web page.
There are a number of samples of the individual pars of this, but not one together, so you are going to have to put the code together yourself.
09-17-2012 01:36 AM
thanks for reply i saw httpdemo sample but I have to show the result of the html code, not the code itself.
I didn t think it s so complicated saving html page anyway thanks 4 ur time, kind