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

New Contributor
Posts: 2
Registered: ‎04-19-2010
My Device: Bold 9700
My Carrier: AT&T

Getting a call back into Java code from Browser

I display a local web page in the browser.  When the user clicks certain links, I need my Java code to get notified somehow such that I can take certain actions.  This seem possible in 5.0 using BrowserField.  However, we really need to support pre-5.0 if possible. Can anyone suggest a way to accomplish this?


We have full control over the HTML content so we can set the hrefs of the links to use some unusual protocol or string if need be.



BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Getting a call back into Java code from Browser

You could implement an HttpFilter to accomplish this.  The HttpFilter allows you to register a specific domain.  Then, whenever the BlackBerry Smartphone attempts to access that domain the connection would be passed to your application, which could supply the content (could be local or remote). 


So you could make use of a unique domain for these links within your local content that get routed through the HttpFilter.  The httpfilterdemo included with the BlackBerry Java SDK and BlackBerry JDE shows an example of this.

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