Add An Object In The Runtime Store; Replace An Object In The Runtime Store; Retrieve A Registered Runtime Object - Blackberry JAVA DEVELOPMENT ENVIRONMENT - - DEVELOPMENT GUIDE Manual

Version: 4.7.0
Hide thumbs Also See for JAVA DEVELOPMENT ENVIRONMENT - - DEVELOPMENT GUIDE:
Table of Contents

Advertisement

Development Guide

Add an object in the runtime store

1.
Import the following classes:
• net.rim.device.api.system.RuntimeStore
• java.lang.String
• java.lang.IllegalArgumentException
2.
Invoke RuntimeStore.put(long, String) and provide as parameters a unique long ID and the runtime object
to store.
3.
Create a try - catch block to manage the IllegalArgumentException that put() throws if a runtime object
with the same ID exists.
RuntimeStore store = RuntimeStore.getRuntimeStore();
String msg = "Some shared text";
long ID = 0x60ac754bc0867248L;
try {
store.put( ID, msg );
} catch(IllegalArgumentException e) {
}

Replace an object in the runtime store

1.
Import the following classes:
• net.rim.device.api.system.RuntimeStore
• java.lang.String
• net.rim.device.api.system.ControlledAccessException
2.
Invoke replace().
3.
Create a try - catch block to manage the ControlledAccessException that replace() throws if the runtime
object with the specified ID does not exist.
RuntimeStore store = RuntimeStore.getRuntimeStore();
String newmsg = "Some new text";
try {
Object obj = store.replace( 0x60ac754bc0867248L, newmsg);
} catch(ControlledAccessException e) {
} not exist

Retrieve a registered runtime object

1.
Import the following classes:
• net.rim.device.api.system.RuntimeStore
• net.rim.device.api.system.ControlledAccessException
52
Runtime storage

Advertisement

Table of Contents
loading

This manual is also suitable for:

Java development environment

Table of Contents