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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 45
Registered: ‎08-29-2013
My Device: Blackberry curve-9360 and Blackberry bold-9860
My Carrier: Company

BrowserField displayContent show Blank Screen

Hello,

 

I have used BrowserField to load URL. The URL first show form, When i enter text and submit it, it switches to thanks page.

The browser field always load form page but when i submit the text it sometimes show me white page. I have also try in device browser and it always load url properly.

 

Here is my code :

 

BrowserField browserField = new BrowserField();

add( browserField );

browserField.requestContent( "myURL;interface=wifi" );

 

I also tried with browsetfieldlistener

 

       StreamConnection c = null;
        InputStream s = null;
        byte[] response = null;
        
       
        try {
            c = (StreamConnection)Connector.open("myURL;interface=wifi");
            s = c.openInputStream();

            response = IOUtilities.streamToBytes(s);
            
        
        } catch (Exception e) {
            System.err.println("---error---"+e.getMessage());
        } finally {
            if (s != null)
                try {
                    s.close();
                } catch (IOException e) {
                    System.err.println("---error---"+e.getMessage());
                    e.printStackTrace();
                }
            if (c != null )
                try {
                    c.close();
                } catch (IOException e) {
                    System.err.println("---error---"+e.getMessage());
                    e.printStackTrace();
                }
        }
        String html = new String(response);
        
        System.out.println("----html content---"+html);        
        
         BrowserFieldConfig myBrowserFieldConfig = new BrowserFieldConfig();
              myBrowserFieldConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE,BrowserFieldConfig.NAVIGATION_MODE_POINTER);
         myBrowserFieldConfig.setProperty(BrowserFieldConfig.JAVASCRIPT_ENABLED, Boolean.TRUE);
         
         BrowserField browserField = new BrowserField(myBrowserFieldConfig);
         add(browserField);
         
         BrowserFieldListener bfl = new BrowserFieldListener() {
            
                public void documentLoaded(BrowserField browserField,
                    Document document) throws Exception {

                        super.documentLoaded(browserField, document);
                        // Performing some operation
                    }
                }

            
         };
         browserField.addListener(bfl);
         browserField.displayContent(html, "myURL;interface=wifi");

 

Please suggest me whats the problem

 

Thanks in advance