WAP之家:为您提供最全最新的WAP技术,CP.SP.3G等行业资讯。 WAP之家交流论坛全新开放 点击进入>>
WAP资讯 | 3G动态 | SP动态 | 运营商动态 | 内容商动态 | 制造商动态 | 论坛讨论>> 每次自动访问
WAP技术 | WAP源码 | 手机编程 | 手机源码 | 无线技术 | J2ME技术 | 手机软件 添加到收藏夹
IVR技术 | SP资料 | SMS MMS技术 | 商业方案 | IVR下载 | 书籍教程 | 工具软件 语言:繁體中文

WAP之家技术文章手机编程BlackBerryBlackBerry 应用程序开发者指南 第二卷:高级--第13章 应用程序间共享运行时对象

BlackBerry 应用程序开发者指南 第二卷:高级--第13章 应用程序间共享运行时对象
作者:佚名  来源:本站整理  发布时间:2008-3-15 2:25:25

替换一个运行时对象

>调用 replace().

RuntimeStore store = RuntimeStore.getRuntimeStore();

String newmsg = "Some new text";

try {

    // Returns the existing object with the specified ID if it exists; null

    // otherwise.

    Object obj = store.replace( 0x60ac754bc0867248L, newmsg);

}

catch(ControlledAccessException e) {

    // Handle exception - insufficient permissions.

}

获取一个注册的运行时对象

>调用RuntimeStore.get(). 将对象ID作为参数.

RuntimeStore store = RuntimeStore.getRuntimeStore();

// get() throws a ControlledAccessException if your application does not have read access to the specified object.

try {

    // get() returns the objectm with the specified ID if it exists; null

    // otherwise.

    Object obj = store.get(0x60ac754bc0867248L);

}

catch(ControlledAccessException e) {

    // Handle exception.

}

获取一个未注册的运行时对象

>调用RuntimeStore.waitFor() 等待一个运行时对象注册.

RuntimeStore store = RuntimeStore.getRuntimeStore();

try {

    Object obj = store.waitFor(0x60ac754bc0867248L);

}

catch(ControlledAccessException e) {

    // Handle exception - insufficient permissions.

}

catch(RuntimeException e) {

    // Handle exception - time out.

}

 

 如果指定ID的对象不存在, waitFor()会阻止一个MAX_WAIT_MILLIS的最大数.如果此时对象还没有注册, waitFor()将会抛出一个RuntimeException异常.

上一页  [1] [2] 

[] [返回上一页] [打 印]
文章评论

用户名: 查看更多评论

分 值:100分 85分 70分 55分 40分 25分 10分 0分

内 容:

         (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码