BrowserField Sample Code - Create your first BrowserField2 application

by Retired on ‎05-03-2010 11:51 AM - edited on ‎09-20-2010 04:56 PM by Retired (13,512 Views)


BrowserField is a class added to version 5.0 of the BlackBerry Java Development Environment that can be used to easily embed web content in a native (Java) BlackBerry application.


This class is commonly known as BrowserField2 because the previous RenderingSession and BrowserContent APIs (prior to 5.0) were collectively known as BrowserField when used.


Creating your first BrowserField2 application involves the following three steps:


  1. Create a BrowserField object
  2. Add the BrowserField to the screen
  3. Request content


Here is the source code for a fully functional BlackBerry application that uses the BrowserField API to display the content of



package samplecode;

import net.rim.device.api.ui.container.*;
import net.rim.device.api.browser.field2.*;
import net.rim.device.api.ui.*;

class MyBrowserField2Sample extends UiApplication
private MainScreen _screen;
private BrowserField _bf2;

_bf2 = new BrowserField();

_screen = new MainScreen();


public static void main(String[] args)
MyBrowserField2Sample app = new MyBrowserField2Sample();


See the following learning resources for more information on the BrowserField API: