58
BlackBerry Device Applications Integration Guide
Define callback functionality for a
rendering session.
>
Implement the
RenderingApplication
interface.
Retrieve a BlackBerry® Browser field.
1.
Invoke
RenderingSession.getBrowserContent(javax.microedition.io.HttpConnecti
on, net.rim.device.api.browser.field.RenderingApplication,
net.rim.device.api.browser.field.Event).
2. Store the returned object in a
BrowserContent
object. You render web content in the
BrowserContent
object.
BrowserContent browserContent =
_renderingSession.getBrowserContent(HttpConnection connection, this,
Event e);
Retrieve a field in which the URL
content is rendered to your
BlackBerry® Java® Application for
display.
>
Invoke
BrowserContent.getDisplayableContent()
, storing the returned object in a
Field
object.
Field field = browserContent.getDisplayableContent();
Display a BlackBerry® Browser field.
1.
To clear the current screen, invoke the
MainScreen.deleteAll()
method.
_mainScreen.deleteAll();
2. To add field data to the BlackBerry Java® Application screen, invoke
MainScreen.add().
_mainScreen.add(field);
3. Create a non-main event thread to run
BrowserContent.finishLoading()
so that the UI
does not lock.
4. To render the new BlackBerry browser content, invoke
BrowserContent.finishLoading().
HTML files display a blank field until you invoke
BrowserContent.finishLoading()
. WML files and images might load before you invoke
this method.
Create a separate thread for rendering. >
Create a non-main thread that contains the instructions for retrieving and displaying the
BlackBerry® Browser field.
class CreationThread extends Thread {
BrowserFieldHandlerApplication _callBackApplication;
BasicRenderingApplication _renderingApplication;
public CreationThread(BrowserFieldHandlerApplication
callBackApplication) {
_callBackApplication = callBackApplication;
}
public void run() {
_renderingApplication = new
BasicRenderingApplication(_callBackApplication);
BrowserField field =
_renderingApplication.getBrowserField("www.blackberry.com");
_callBackApplication.displayBrowserField(field);
}
}
Set rendering options.
>
Override
BrowserContent.getRenderingOptions()
. Your BlackBerry® Java® Application
uses the default rendering options if you do not override
BrowserContent.getRenderingOptions()
.
Task
Steps
Содержание JAVA DEVELOPMENT ENVIRONMENT - - DEVICE APPLICATIONS INTEGRATION - DEVELOPMENT GUIDE
Страница 1: ...BlackBerry Java Development Environment Version 4 6 0 BlackBerry Device Applications Integration Guide...
Страница 4: ......
Страница 7: ......
Страница 10: ...10 BlackBerry Device Applications Integration Guide...
Страница 12: ...12 BlackBerry Device Applications Integration Guide...
Страница 50: ...50 BlackBerry Device Applications Integration Guide...
Страница 56: ...56 BlackBerry Device Applications Integration Guide...
Страница 65: ......
Страница 66: ...2008 Research In Motion Limited Published in Canada...