06-11-2009 05:57 AM
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
06-11-2009 06:01 AM
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..
06-11-2009 06:10 AM
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(D
}
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.
06-11-2009 06:17 AM
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..
06-11-2009 06:25 AM
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.
06-11-2009 06:47 AM
06-11-2009 07:46 AM
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
06-11-2009 07:59 AM
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..