Code sample: Getting a stored String from the runtime store
For simplicity, this example does not show how to create the unique ID.
import net.rim.device.api.system.RuntimeStore;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
public class RuntimeGet extends UiApplication
{
public static void main(String[] args)
{
RuntimeGet app = new RuntimeGet();
app.enterEventDispatcher();
}
public RuntimeGet()
{
RuntimeStore rts = RuntimeStore.getRuntimeStore();
long ID = 0x60ac754bc0867248L; //just a unique ID - generate any way you want
String msg = (String)rts.get(ID);
pushScreen(new HomeScreen(msg));
}
}
class HomeScreen extends MainScreen
{
public HomeScreen(String msg)
{
add(new LabelField(msg));
}
}
Previous topic: Code sample: Storing a String in the runtime store