11-27-2008 04:52 AM
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:
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-27-2008 12:31 PM
I'm looking for some more general solutions. I don't yet have a positive answer but see if any of this
I've encountered a bunch of little issues like this. One general strategy is to try to encapsulate the thing
of interest, in this case presumably the browserfield but in the past I've used this with connections.
In this case, the protected and final fields make this impossible but I have a nice script for extracting
an encapsulation skeleton from javadocs
To make things worse, this doesn't come from the context menu AFAIK. Further, the fields do
not appear to be nested at least on my 7130.
What does appear to work is the default "copy" will execute and you can get the name the user
sees onto the clipboard. If you have encapsulated the http connection, you have a shot at figuring out
what the target is from the source but I haven't been able to determine that you can even guess what part of the screen is selected.
11-27-2008 02:21 PM
I'm sure can appreciate the limitations of this but it does work, at least as far
as getting the target link LOL. I don't think I've done a kluge like this in a few days or so.
protected void makeMenu(Menu menu, int instance)
[... various null checks ...]
[ ... more details ... ]
// this relies on the default being a "copy" option
// you have buffered the source code for the page viewer here:
// and have the html as a byte array. [ clever you ]
if ( p!=null) ps=new String(p);
// presumably this is the "copy" command and label exists in html source
int zz= ps.indexOf(Clipboard.getClipboard().toString());
[ ... fancy string proc here to get href ...]
// verify we have somthing we thought,
// int xxxx=Dialog.ask(Dialog.D_YES_NO, tgt);
[ .. some other kluge to abort the nascent menu, probably popscreen or something ....]
12-03-2008 09:01 AM - edited 12-03-2008 09:02 AM
What you describe isn't directly supported by the browser field APIs. The rendering engine used by the browserfield differs from the BlackBerry Browser.
What you could do is capture the trackball click and execute the Get Link menu item directly. However, this has a shortfall in that it relies on the menu item having the matching text, meaning you'll need to search for different translations of it.
This post has sample code on doing this for the enter key.
12-10-2008 03:50 AM
I need code example of blackberry browser,
I get it from book but it cant run
can you send it to me 3 files of that one on my mail id : firstname.lastname@example.org