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
Developer
Posts: 1,006
Registered: ‎05-22-2009
My Device: Not Specified

Doubts in Using HTML Pages

 

In Android,there is a web view,in which HTML Page rendering is done based on the devices.

 

I am new to concept of displaying a web page in device.AnyIdeas about it will be helpful.

Hello Guys, i want to carry out HTML Page rendering in the device.How can it be done?

 

 

Regards

 

Rakesh Shankar.P

Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Doubts in Using HTML Pages

Have you actually used the one on Android ? Displaying real web pages involves many steps, see my posts here or on webkit developers forum. If you control the content it is not hard but getting general browser to work is a bit more involved. I thought the latest browserfield would fix that but I'm running into many issues- the first being timing. Be prepared to chase 30x redirects yourself and on my old sim I found fatal timing problems - both seem to be due to unsafe or race conditions as you can step through code and see scheduling and spawning seem to be in wrong order.

 

So, the answer is it depends.

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Doubts in Using HTML Pages

If you just have an HTML page to display, with no interaction to external data, then the processing is relatively straightforward.  In OS 5.0 and above you just invoke BrowserField, passing the HTML page in.  On older OS'es, it is more complicated because you need to simulate an http connection.  There is code on the forum that will help with this.

 

Let us know what you are trying to do and what OS you are targeting and we should e able to point you at some useful links. 

 

 

Developer
Posts: 1,006
Registered: ‎05-22-2009
My Device: Not Specified

Re: Doubts in Using HTML Pages

I dont have much of interaction to the data,just want display the HTML Pages.I just checked the browser field also which supports from 5.0 and above.But i want it to be supported from 4.3 above.So I am trying to find something related to it.

 

 

Regards

 

Rakesh Shankar.P

Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Doubts in Using HTML Pages

We have played with those but I don't remember exact name- you can grep

javadocs for "Browser" or something like that. See my prior posts however,

depending on what you are trying to do you may need to kluge a few things

and you really need your own connection classes.

Developer
Posts: 1,006
Registered: ‎05-22-2009
My Device: Not Specified

Re: Doubts in Using HTML Pages

Hi ,Marchyka,as  i have said in my above post,i just like to display simple HTML Pages from the webPage and display in it my application.How about the usuage of  browser content,canit be used

 

Regards

 

Rakesh Shankar.P

BrowserContent

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Doubts in Using HTML Pages

Try this:

http://stackoverflow.com/questions/2665298/display-simple-web-page-in-my-application-using-blackberr...

 

Search the forum for 'local html', there are few other samples of doing this sort of thing.  But the process is the same.  You must replace the http connection used by the Browser with your own. 

Developer
Posts: 1,006
Registered: ‎05-22-2009
My Device: Not Specified

Re: Doubts in Using HTML Pages

Hi Peter,I read through the articles and i tried using this KB article.I just want to display the data with the Field

 

 

public class RawHTMLBrowserSample extends UiApplication
{

	
public static void main( String[] args )
{
RawHTMLBrowserSample sample = new RawHTMLBrowserSample();
sample.enterEventDispatcher();
}

/**
* Create the splash screen and start off the networking
* thread that will eventually invoke the browser.
*/
public RawHTMLBrowserSample()
{
MainScreen splashScreen = new MainScreen();
splashScreen.add( new RichTextField( "Please Wait..." ));
pushScreen( splashScreen );
//MyThread thread = new MyThread();
//thread.start();
HttpConnection connection = null;
try {
	connection = (HttpConnection)Connector.open( "http://www.blackberry.com:80;deviceside=false" );
} catch (IOException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}
BrowserContent bc = null;
try {
	bc = RenderingSession.getNewInstance().getBrowserContent(connection,null,0);
} catch (RenderingException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}
Field f = bc.getDisplayableContent();
splashScreen.add(f);     
pushScreen( splashScreen );  
}
}

 

 

But i did nt get any output.It just hangs out.How could it be done?

 

Can i opt for BrowserContentBaseImpl, didnt want invoke the native browser,

 

Regards

 

Rakesh Shankar.P

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Doubts in Using HTML Pages

There are a number of issues here, I think we must step back and solve them one at a time.

 

I was under the impression that you wished to display local content.  It seems I was wrong - it seems you want to display some 'remote' content but in your own application.

 

Here is a good video what you tell you how to do this:

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

 

The other thing is that you are trying to do this processing while starting up your application.  Remove that code for the moment.  Just do this as a standard browser screen as shown in the video.  The issue with doing things at startup is complicating the processing. 

 

So get a normal Browser Field working as shown in the Video, and then ask a  separate question about how to create this display while you are displaying your Splash Screen. 

Developer
Posts: 1,006
Registered: ‎05-22-2009
My Device: Not Specified

Re: Doubts in Using HTML Pages

Hello Peter,i got the output for the above code,with the addition of finishloading() method.But Peter as you said since i do processing and screen showing in the same time ,screen does not pop up until website fully loads,So i need to open the Screen first with title with loaded  and based on downloading of the site ,it has to be viewed.How could it be done?

 

Do i require thread to handle  this?

 

 

Regards

 

Rakesh Shankar.P