Code Sample; Code Sample: Using The Blackberry Browser - Blackberry JAVA DEVELOPMENT ENVIRONMENT - - DEVICE APPLICATIONS INTEGRATION - DEVELOPMENT GUIDE Integration Manual

Blackberry device applications integration guide
Table of Contents

Advertisement

BlackBerry Device Applications Integration Guide

Code sample

Code sample: Using the BlackBerry Browser

Example: BrowserFieldSampleApplication.java
/**
* DefaultRenderingApplication.java
* Copyright (C) 2004-2005 Research In Motion Limited.
*/
package com.rim.samples.docs.browser;
import java.io.IOException;
import javax.microedition.io.HttpConnection;
import net.rim.device.api.browser.field.*;
import net.rim.device.api.io.http.HttpHeaders;
import net.rim.device.api.system.Application;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.Status;
import net.rim.device.api.ui.container.MainScreen;
final public class BrowserFieldSampleApplication extends UiApplication implements
RenderingApplication
{
private static final String REFERER = "referer";
private RenderingSession _renderingSession;
private MainScreen _mainScreen;
private HttpConnection
public static void main(String[] args) {
BrowserFieldSampleApplication app = new BrowserFieldSampleApplication();
app.enterEventDispatcher();
}
private BrowserFieldSampleApplication() {
_mainScreen = new MainScreen();
pushScreen(_mainScreen);
_renderingSession = RenderingSession.getNewInstance();
PrimaryResourceFetchThread thread = new PrimaryResourceFetchThread("http://
www.google.com", null, null, null, this);
thread.start();
}
public void processConnection(HttpConnection connection, Event e) {
// cancel previous request
if (_currentConnection != null) {
try {
_currentConnection.close();
} catch (IOException e1) {
}
}
_currentConnection = connection;
60
_currentConnection;

Advertisement

Table of Contents
loading

This manual is also suitable for:

Java development environment 4.6.0

Table of Contents