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
Contributor
Posts: 16
Registered: ‎06-29-2010
My Device: Not Specified
My Carrier: -

How to display a web page in a field instead of in the browser?

Hello, I am just getting to blackBerry, coming from Android world. And I am currently developping an application for BlackBerry OS 4.6.0. I would like to display an internet web page in a Field, with the same rendering as if displayed in the browser: images, javascript, hyperlinks, etc. But I could not manage to find any solution yet Smiley Sad. I could not manage to find any tutorial either Smiley Sad. Could you help me? Thank you Smiley Happy. *** Simplified code in Android (view=field): private WebView setUpWebView(String url) { WebView webView = new WebView(); webView.setWebViewClient(new Dialog.WebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl(url); } mContent.addView( setUpWebView("http://www.google.fr") );
Android and iPhone/iPad developer Smiley Happy... forced to develop for BlackBerry (beginner) Smiley Sad
New Developer
Posts: 24
Registered: ‎07-30-2008
My Device: Not Specified

Re: How to display a web page in a field instead of in the browser?

Did you check the Blackberry BrowserField Sample from the SDK?

samples\com\rim\samples\device\blackberry\browser

Developer
Posts: 85
Registered: ‎05-03-2010
My Device: Not Specified

Re: How to display a web page in a field instead of in the browser?

[ Edited ]

Hello Korriged,

Welcome to forum Sir/Maam. You are a breath of fresh air to the forum, as i've seen posts that say they are leaving BB for Android , where as you are coming to the BB from the Android World Smiley Very Happy

 

So, about the BrowserField, let me first of all tell you that the BrowserField does not render the pdf's as yet. It basically renders html decently though. Check this post of mine.

 

http://supportforums.blackberry.com/t5/Java-Development/Problem-in-opening-a-pdf-url-in-a-BrowserFie...

 

Here i've got links to a few BrowserField examples and i've got a snippet of a working BrowserField from the book Apress Advanced BlackBerry Development by Chris King . This is the basic sample from the book, there is one advanced sample as well. You can find the soft copy of the book online.

 

Plus, you might want to look into another good beginners book which goes by the name Beginning Blackberry Development by Anthony Rizk.

 

Cheers.

 

EDIT: Edited at users request

Contributor
Posts: 16
Registered: ‎06-29-2010
My Device: Not Specified
My Carrier: -

Re: How to display a web page in a field instead of in the browser?

Thank you vick_man Smiley Happy... and sorry for the delay to answer. In fact it seems it is only possible from v5.0 on Smiley Sad. BlackBerry phone were not supposed to browse before I guess Smiley Wink.
Android and iPhone/iPad developer Smiley Happy... forced to develop for BlackBerry (beginner) Smiley Sad
Contributor
Posts: 16
Registered: ‎06-29-2010
My Device: Not Specified
My Carrier: -

Re: How to display a web page in a field instead of in the browser?

Hi TobiasReaper, thank you for your nice message Smiley Happy. Yes, I am coming to BB... but I'm not sure to stay long: the development environment is horrible (very slow, very unstable, J2ME only, poor documentation of the API, etc.), the SDK (at least 4.6) is pretty poor (no button with images, background management, etc.) and old-fashioned, and BlackBerry phones/UI are ugly (almost like 10-years ago) Smiley Sad. It is very very far from Android and iPhone. It seems that browser field is only available from 5.0 on Smiley Surprised. Thank you also for the books you recommend me. They help Smiley Happy. Mr. Korriged
Android and iPhone/iPad developer Smiley Happy... forced to develop for BlackBerry (beginner) Smiley Sad
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to display a web page in a field instead of in the browser?

This Video tells you how it can be done in 4.6.  The Browser is not as pretty as the standard Browser on the 4.6 device however.  When you get to 5.0, you get the to access the same Browser. 

 

http://www.blackberry.com/DevMediaLibrary/view.do?name=HowtoembedtheBrowser

Developer
Posts: 68
Registered: ‎02-05-2009
My Device: Not Specified

Re: How to display a web page in a field instead of in the browser?

[ Edited ]

 

 

Korriged wrote:
Yes, I am coming to BB... but I'm not sure to stay long: the development environment is horrible (very slow, very unstable, J2ME only, poor documentation of the API, etc.), the SDK (at least 4.6) is pretty poor (no button with images, background management, etc.) and old-fashioned, and BlackBerry phones/UI are ugly (almost like 10-years ago) Smiley Sad. It is very very far from Android and iPhone. It seems that browser field is only available from 5.0 on

a good post about this situation... It just covers the development hurdles though:

 

 

http://www.inteism.com/2009/04/android-development-vs-blackberry-development/

 

It is a bit outdated now... BB got a simulator that does not have to be restarted recently which helps a lot in the development process and the plugin got much nicer (more Eclipse way) and much more stable as well.

 

It certainly does feel that RIM has improved the development practices a lot lately.

Highlighted
Developer
Posts: 48
Registered: ‎07-28-2009
My Device: Tour 9630
My Carrier: V Dub

Re: How to display a web page in a field instead of in the browser?

Hello Korriged,

 

There Are 2 versions of The BrowserField API, BrowserField2, that is only 5.0 and up, and the older version BrowserField that is a lot heavier coding just to render HTML.

 

As for the picture in the button try the CustomButtonsDemo.

 

There are a lot of demos packaged with the JDE, or the plug-in for Eclipse, to help with mostly getting started, you just have to try them out and see what it is you need. 

 

Good Luck,

 

Brent