Help Center
Local Navigation
- Integrating with BlackBerry Device Software applications
- Message list
- Attachments
- Calendar
- Contact list
- Task list
- Phone
- BlackBerry Browser
- Menu items
- Glossary
- Provide feedback
- Document revision history
- Legal notice
BlackBerry Manuals & Help
>
Documentation for Developers
>
Java Development Guides and API Reference
>
Integration - Development Guide - BlackBerry Java Application - 5.0
Display HTML content from a web page in a browser field
-
Import the required classes and interfaces.
import net.rim.device.api.browser.field2.*; import net.rim.device.api.system.*; import net.rim.device.api.ui.*; import net.rim.device.api.ui.container.*;
-
Create the application framework by extending the
UiApplication class. In
main(), create an instance of the new class and
invoke
enterEventDispatcher() to enable the application to
receive events. In the application constructor, invoke
pushScreen() to display the custom screen for the
application. The
BrowserFieldDemoScreen class, described in step 3,
represents the custom screen.
public class BrowserFieldDemo extends UiApplication { public static void main(String[] args) { BrowserFieldDemo app = new BrowserFieldDemo(); app.enterEventDispatcher(); } public BrowserFieldDemo() { pushScreen(new BrowserFieldDemoScreen()); } } -
Create the framework for the custom screen by extending the
MainScreen class.
class BrowserFieldDemoScreen extends MainScreen { public BrowserFieldDemoScreen() { } } -
In the screen constructor, create an instance of the
BrowserField class.
BrowserField myBrowserField = new BrowserField();
-
In the screen constructor, invoke
add() to add the
BrowserField object to the screen.
add(myBrowserField);
-
In the screen constructor, invoke
BrowserField.requestContent() to specify the
location of the HTML content and display it.
myBrowserField.requestContent("http://www.blackberry.com");
Previous topic: Display HTML content in a browser field