Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to suppress the browser top bar while using a BlackBerry BrowserSession

I am trying to create an app that will redirect to a certain webpage when run. I would like this app to be full screen with no title bar or browse bar. I am able to call a BrowseSession to bring up the proper website in the browser but it doesn't give me the desired feel.

Here is the code I am using for the BrowseSession:

BrowserSession browser = Browser.getDefaultSession();
browser.displayPage("http://www.stackoverflow.com");

I have looked into using a BrowseField for this but I find that it does not act in the same fashion as a regular BrowseSession. The device Back Button closes the app and I receive errors in my simulator when JavaScript code is being run. My code for this follows:

String baseURL = "http://www.stackoverflow.com";

BrowserFieldConfig config = new BrowserFieldConfig();
config.setProperty(BrowserFieldConfig.JAVASCRIPT_ENABLED, Boolean.TRUE);
BrowserField browserField = new BrowserField(config);
add(browserField);

browserField.requestContent(baseURL);

Any help will be greatly appreciated.

like image 623
Scott Boettger Avatar asked Oct 23 '22 23:10

Scott Boettger


1 Answers

There is no way to control the overall appearance of the browser programmatically, so you're stuck with the title bar and browse bar if you use BrowserSession.

And JavaScript is broken for BrowserField on some of the simulators, although I think it may work on all the actual devices (although I wouldn't be surprised if it didn't work).

The only thing I can suggest is handling and cancelling the ESC key (aka the back button) press, which should at least prevent the app from closing.

like image 137
MusiGenesis Avatar answered Nov 01 '22 16:11

MusiGenesis