Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Posts: 5
Registered: ‎03-06-2012
My Device: BlackBerry 8900 Curve, O.S. 5.0.0.1067base+Brizan

How can I save an html page?

Hi to all, bbDevelopers Smiley Happy 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 Smiley Very Happy

 

so..how can i save these content in local memory? is there a one easy method??

I pray U Smiley Sad

_sh4d3

No pain, no gain XD
New Contributor
Posts: 5
Registered: ‎03-06-2012
My Device: BlackBerry 8900 Curve, O.S. 5.0.0.1067base+Brizan

Re: How can I save an html page?

anybody? 

_sh4d3

No pain, no gain XD
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How can I save an html page?

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. 

 

Good luck.

Highlighted
New Contributor
Posts: 5
Registered: ‎03-06-2012
My Device: BlackBerry 8900 Curve, O.S. 5.0.0.1067base+Brizan

Re: How can I save an html page?

thanks for reply Smiley Happy 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 Smiley Surprised anyway thanks 4 ur time, kind Smiley Happy

_sh4d3

No pain, no gain XD