Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Regular Contributor
anawara
Posts: 61
Registered: 04-27-2010
My Carrier: Vodafone
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? 

Please use plain text.
Regular Contributor
anawara
Posts: 61
Registered: 04-27-2010
My Carrier: Vodafone

Re: Invoking the browser opens default tab

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

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 410
Registered: 04-12-2010
My Carrier: Rogers

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
BlackBerry Development Advisor
@WaterlooErik
Please use plain text.
Regular Contributor
anawara
Posts: 61
Registered: 04-27-2010
My Carrier: Vodafone

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

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 410
Registered: 04-12-2010
My Carrier: Rogers

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
BlackBerry Development Advisor
@WaterlooErik
Please use plain text.
Regular Contributor
anawara
Posts: 61
Registered: 04-27-2010
My Carrier: Vodafone

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
Please use plain text.