开发者

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 b开发者_运维知识库ring 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜