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
arindamhit
Posts: 271
Registered: ‎12-24-2010
My Device: BlackBerry 10
My Carrier: Airtel

Browser field is not showing the styles of the web page properly in BlackBerry

Hi,

 

I have webpage which i want to display in the screen in webview. I have implemented the BrowserField2. But web page related styles like color, text format and alignment is not coming. It is coming in a plain text and without any color.

 

My code is here:

 

BrowserFieldConfig bfConfig = new BrowserFieldConfig();
		bfConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE,BrowserFieldConfig.NAVIGATION_MODE_POINTER);
		bfConfig.setProperty( BrowserFieldConfig.JAVASCRIPT_ENABLED, Boolean.TRUE );
		bfConfig.setProperty(BrowserFieldConfig.USER_AGENT, "MyApplication 1.0");
		bfConfig.setProperty( BrowserFieldConfig.VIEWPORT_WIDTH, new Integer(screenWidth - 2));
		BrowserFieldRequest request = new BrowserFieldRequest("xxx.com");
	    browserField = new BrowserField(bfConfig);
		updateBrowserFiled();
		browserField.requestContent(request);
		m_vfmSecond.add(browserField);
		m_vfmScreen.add(m_vfmSecond);
		add(m_vfmScreen);

}



private void updateBrowserFiled()
	{
		 Logger.out("Car", "inside the browser field ");
		
		 UiApplication.getApplication().invokeLater( new Runnable() {
	            public void run() {
	                
	           	 mProgressBar.show();
	                
	           }
	       });
		 browserField.addListener(new BrowserFieldListener() 
			{
				   public void documentLoaded(BrowserField browserField, Document document) throws Exception {
		                 UiApplication.getApplication().invokeLater( new Runnable() {
		                     public void run() {
		                         
		                    	 mProgressBar.deleteScreen();
		                         
		                    }
		                });
					   Logger.out("Car", "document loaded ");
		                 super.documentLoaded(browserField, document);

		             }
				   
				   public void documentError(BrowserField browserField, Document document)throws Exception
				   {
					   UiApplication.getApplication().invokeLater( new Runnable() {
		                     public void run() {
		                         
		                    	 mProgressBar.deleteScreen();
		                    	 Dialog.alert("Error occured. Please try again");
		                         
		                    }
					   });
				   }
		     });
	}

 Can any one please tell me what extra things i need to add here to get the desired result which is attached and shown here. Thanks.

 

Capture.PNG

Please use plain text.