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
New Developer
Posts: 10
Registered: ‎06-02-2009
My Device: Not Specified

Invoke browser in a desired view mode

I have a need to invoke default browser for my current application.

I am using JDE 4.7 and the application is for Storm.

 

To invoke browser, i m using following code snippet:

 

            BrowserSession browserSession = Browser.getDefaultSession();
            // now launch the URL
            browserSession.displayPage(url);
            browserSession.showBrowser();

 

 This is working fine.

 

But my additional requirement is to open browser in a particular mode - either in Landscape or in Portrait.

 

There is a setting in my application, in which user can save this. Based on that setting whenever user will launch browser from above code - it should be opened in the saved mode.

 

I searched in forum for this. But i did not find anything yet.

can anyone tell me how to do this?

 

Thanks,

Suresh 

Developer
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: Invoke browser in a desired view mode

Storm features with accelerometer, which it self change to portrait or landscape mode according to the position on which the blackberry stands.. I don't know about 3rd party application, but native applications(Blackberry Browser for this case) would automatically turn Landscape/Portrait mode!

 

I have no meaning in setting it to a certain nor aware of any methods to do so..

 

Cheers.. 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
New Developer
Posts: 10
Registered: ‎06-02-2009
My Device: Not Specified

Re: Invoke browser in a desired view mode

Hi mantaker,

 

Thanks for quick reply.

 

For main screens of my application, I am able to set the landscape and protrait view by overriding onUiEngineAttached method as follows:

 

 protected void onUiEngineAttached(boolean attached) {
         // call to super
         super.onUiEngineAttached(attached);
         // force the engine to keep it landscape mode only
         Ui.getUiEngineInstance().setAcceptableDirections(Display.DIRECTION_PORTRAIT);
   }

 

Here DIRECTION_PORTRAIT sets the view mode of the screen to protrait. I can do same for landscape by using DIRECTION_LANDSCAPE.

 

But when it comes to open a default browser and set the view mode, I did not find any solution yet.

Since my applicaiton is a replication of iPhone application, where this feature is available. So, I think there might be any way in Blackberry also.

 

So any help or idea for this.

Developer
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: Invoke browser in a desired view mode

Let me be an optimist here.. If the application acts in portrait mode then the user will hold his device upside up and downside down(Here your browser code will get invoked in portrait mode).. Well, the pretty other case, Landscape mode, user will hold the device leftside down and rightside up.. If this is the case, the blackberry storm is smart enough to find the position it is held and open in landscape mode..

 

I mean you don't have to have a setting for it..

 

However, initiating the browser does not have such sophistication like you expect..

 

Cheers.. 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
New Developer
Posts: 10
Registered: ‎06-02-2009
My Device: Not Specified

Re: Invoke browser in a desired view mode

I think, I was not clear for the problem.

 

Let me explain in more detail.

I know Blackberry storm device automatically handles the screen , when user rotate the device.

But in my case, I want only portrait view. I am able to fix the portrait mode for the screens in my application, which I extends from MainScreen class. The code, I posted previously is used for this.

 

But for a browser, I am not able to do this.

 

I want the browser to be fixed in same mode - all time, untill user  will not make changes for the settings. Assume there are two options:

1. Landscape 

2. Portrait

 

If user selects Landscape - then whenever the default browser will be launched - it should be in landscape mode. It should not change to Portrait mode until the application does not exit.

 

Tell me, if this is not clear.

 

 

Developer
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: Invoke browser in a desired view mode

I understood your question.. That cannot be done..
--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
New Developer
Posts: 10
Registered: ‎06-02-2009
My Device: Not Specified

Re: Invoke browser in a desired view mode

Thanks mantaker,

 

but where can i found this information - for the default applications in blackberry, like Media browser or File browser or Internet browser.

 

I need this info as this will help me in understanding of working of these applications.

 

Thanks again

Highlighted
Developer
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: Invoke browser in a desired view mode

Native applications act in its own way on how it has been designed.. 3rd party applications or we the developers have no control over them..

 

Cheers.. 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group