11-27-2008 04:54 AM
Hi everyone,
We are trying to implement an embedded browser within our UiApplication and
will really appreciate anyone who can help us on an urgent basis.
We are implementing the our UiApplication similar to
the BrowserFieldSampleApplication as below:
BrowserFieldSampleApplication extends UiApplication implements RenderingApplication
{
//with private members among others the following:
BrowserContent browserContent;
BrowserContentManager browserContentMgr;
MainScreen _mainScreen;
}
In this setting the application always shows a default menu popup,
with options like "Page view", "Column view", "Get Link", "Close" etc.
Everytime we click some link on the page, this popup comes up first and we have to choose
"Get-Link" to browse any link.
We want to make this popup disappear and make our browser act like the native browser.
We have tried everything, even called
_mainScreen.removeAllMenuItems(); but nothing helps and the popup stays like that.
When we switch to mouse mode, even when the mouse is clicked on a link,
instead of navigating to the page, the popup comes first and we have to slect the Get-Link from the keyboard.
Is the apis provided to developers different from the native browser's api?
Is there anyway to make the popup disappear?
11-28-2008 09:25 AM
01-27-2010 01:48 PM
In BlackBerry device software version 5.0 you can use the BrowserField2 APIs, which use the new browser rendering engine. This can allow you to mirror the browser included on the BlackBerry smartphone.
01-28-2010 09:55 AM
Unfortunately this gets a bit tricky. Here goes a quick explanation of what you can do:
1. Using browser.field in 4.X and 5.X
- You have to search through the main menu associated with the screen for a menu item that contains the word "Link".
- You will need to do this in navigationClick AND touchEvent for touch devices (4.7 and above).
Menu menu = getScreen().getMenu(0);
String label = null;
int size = menu.getSize();
for(int i=0; i<size; i++)
{
label = menu.getItem(i).toString();
//OS 4.2+ = Get Link, OS 5.0 = Open Link
if(-1 != label.indexOf("Link")) {
item.run();
return true;
}
}
2. Using browser.field2 in 5.X
- As explained by Mark, the new field2.BrowserField class in BB 5.0 will handle the click as you would expect.
- However, I have seen a problem with the new field2.BrowserField class on non-touch devices. Essentially, once you click on the field2.BrowserField object it doesn't relinquish the focus and so you can't use the trackwheel to navigate and select a different type of field on the screen.