Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
tan_addictive
Posts: 11
Registered: ‎10-24-2008
My Device: Not Specified

Embedded browser issue using BrowserContent and RenderingApplication [Urgent]

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?

 

 

 

 

 

Please use plain text.
Developer
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Embedded browser issue using BrowserContent and RenderingApplication [Urgent]

I'm looking for some more general solutions. I don't yet have a positive answer but see if any of this

helps.

 

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 :smileyhappy:

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.

 

 

 

 

Please use plain text.
Developer
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Embedded browser issue using BrowserContent and RenderingApplication [Urgent]

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)
 {
  Field f=getFieldWithFocus();
  [... various null checks ...]

ContextMenu cm=f.getContextMenu();
  [ ... more details ... ]

// this relies on the default being a "copy" option

MenuItem mi=cm.getDefaultItem();
   // you have buffered the source code for the page viewer here:

// and have the html as a byte array. [ clever you ]   

byte[] p=Phlutilities.pccba;
        String ps="";
        if ( p!=null) ps=new String(p);
// presumably this is the "copy" command and label exists in html source         

mi.run();
        int zz= ps.indexOf(Clipboard.getClipboard().toString());
        String tgt=ps;
 [ ... fancy string proc here to get href ...]

     // verify we have somthing we thought, 

  //  int xxxx=Dialog.ask(Dialog.D_YES_NO, tgt); 

navigate(tgt);

[ .. some other kluge to abort the nascent menu, probably popscreen or something ....]

 

 

 

Please use plain text.
Administrator
MSohm
Posts: 14,369
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Embedded browser issue using BrowserContent and RenderingApplication [Urgent]

[ Edited ]

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.

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=8704&query.id=153...

Message Edited by MSohm on 12-03-2008 09:02 AM
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Developer
bhaumik_darji
Posts: 5
Registered: ‎12-10-2008
My Device: Not Specified

Re: Embedded browser issue using BrowserContent and RenderingApplication [Urgent]

HI

 

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 : bhaumik_svit@yahoo.com

 

thanks

 

 

Please use plain text.