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
Regular Contributor
anawara
Posts: 64
Registered: ‎04-27-2010
My Device: Bold 9000
Accepted Solution

Invoking the browser opens default tab

Hi guys,

 

I'm writing an application which invokes the browser and sends it a URL to open for the user. This is working perfectly on OS 4.6 to 5.0. However, on OS 6 and 7 the browser is always opened with two tabs; one includes the URL I'm trying to open and the other is the default BlackBerry browser page. Furthermore, the tab with the detaulf blackberry browser page is in focus and my users almost always miss to see that there's another tab open on their browser.

 

Has anyone seen this behavior before? If so, do you know how I can solve that problem? 

Regular Contributor
anawara
Posts: 64
Registered: ‎04-27-2010
My Device: Bold 9000

Re: Invoking the browser opens default tab

Anyone has any idea what's wrong here you guys?

BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: Invoking the browser opens default tab

Hello anawara,

 

Can you share the code snippet, where you are configuring and invoking your browser, for us to take a look at?

 

Erik Oros

BlackBerry Development Advisor


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Regular Contributor
anawara
Posts: 64
Registered: ‎04-27-2010
My Device: Bold 9000

Re: Invoking the browser opens default tab

Hi Erik,

 

I first use the BrowserSessionFactory found here then the following code runs 

    int i = Dialog.ask(Dialog.D_YES_NO,"Open website?");
                    if(i == Dialog.YES){
                        BrowserSession b = BrowserSessionFactory.createBISBrowserSession();
                        if(b == null){                                                    
                            b = BrowserSessionFactory.createBESBrowserSession();
                            if(b == null){
                                b = BrowserSessionFactory.createWAPBrowserSession();
                                if(b == null){
                                    b = BrowserSessionFactory.createDefaultBrowserSession();
                                }
                            }
                        }
                        String url = obj.getWebsite();
                        if(!url.startsWith("http"))
                            url = "http://"+url;
                        b.displayPage(url);
                        b.showBrowser();}

 

I am compiling on SDK 4.6. However, this behavior only happens with OS 6 since previous versions of the browser didn't have the multiple tabs feature

BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: Invoking the browser opens default tab

Hello anawara,

 

I'm working from memory here, but I believe that the call to b.displayPage(url) shows the browser to your URL, and then b.showBrowser() launches the 2nd tab. If you remove the call to b.showBrowser() on 6.0+, I believe that the second tab will not be created and only your URL will be displayed.

 

I'll double-check this in a sample, but I do recall thsi coming up before and am fairly sure that's where the issue stems from.

 

Erik Oros

BlackBerry Development Advisor


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Regular Contributor
anawara
Posts: 64
Registered: ‎04-27-2010
My Device: Bold 9000

Re: Invoking the browser opens default tab

Hi Erik,

I've tried your solution. On the simulator calling both methods display the website correctly without the additional tab. However on devices running OS6+ this behavior occurs. I've disabled the call of showBrowser on OS6+ and tried on a device and it worked like a charm. Thanks a lot for your help! this has been puzzling me for a couple of months now!

Cheers,
Ahmed Nawara