bada的系统事件
来源:互联网 发布:像差 知乎 编辑:程序博客网 时间:2024/05/16 10:43
System Events
Application 类提供了处理如下系统事件的事件处理器
- 电池事件(Battery events)
- 内存事件(Memory events)
- 屏幕事件(Screen events)
电池事件(Battery Events)
当电池电量等级改变时该事件被触发。像相机、MP3播放器这样耗电量大的多媒体应用需要检测电池电量等级。使用 OnBatteryLevelChanged() 事件处理器来处理电池事件。 当电池电量等级改变时该处理器被调用。
根据电量,推荐下面的处理方式:
- EMPTY:关闭应用程序。
- CRITICAL:停止使用多媒体特性,因为在该电量等级下,不能保证他们能够正常使用。
OnBatteryLevelChanged() 事件处理器的使用方法如下:
void MyApplication::OnBatteryLevelChanged(BatteryLevel batteryLevel){ // TODO:}
内存事件(Memory Events)
当设备内存低时该事件被触发。当内存低或不足以运行一个应用时,在OnLowMemory() 事件处理器中从堆中释放不用的内存。
OnLowMemory() 事件处理器使用方法如下:
void MyApplication::OnLowMemory(void){ // TODO:}
屏幕事件(Screen Events)
An application can receive screen events in OnScreenOn() and OnScreenOff() event handlers if it registers a screen event listener. When the OnScreenOff() event handler is triggered, the application must reduce power consumption by releasing the activated resources, such as 3D, media, and sensors, which are no longer used. The released resources can be acquired again when the OnScreenOn() event handler is triggered.
You must handle the resources efficiently in the OnForeground(), OnBackground(), OnScreenOn(), and OnScreenOff() event handlers. Be careful not to duplicate or delete resources.
For example:
- When the touch panel auto-lock mode is enabled in the device, the OnBackground() event handler is called directly after OnScreenOff().
- When the backlight time expires, the OnScreenOff() event handler is triggered. If the device is in the auto-lock mode, OnBackground() is called after OnScreenOff() when the lock UI is displayed.
- When the unlock key is pressed, if the touch lock is enabled, OnScreenOn() is triggered. The OnForeground() event handler is called after the lock UI disappears.
- When the lock key is pressed, OnBackground() is called after the lock UI is displayed. When the backlight turns off, OnScreenOff() is called.
OnScreenOn() 和 OnScreenOff() 事件处理器使用方法如下:
void MyApplication::OnScreenOn (void) { //TODO:} void MyApplication::OnScreenOff (void) { //TODO:}
For more information on system events, see the API Reference.
- bada的系统事件
- bada的系统事件
- Hello Bada!详解之三:Bada的系统应用基础与Bada UI
- 三星整合Bada与Tizen系统 意在挖掘Bada社区
- Hello Bada!详解之二:Bada的C++命名空间
- Hello Bada!详解之四:Bada UI的布局
- bada debug的一些问题
- Bada项目的目录结构
- Bada学习-(十八)事件注入器(触发器)
- 让Bada的GlesCube11 Sample跑起来
- Bada学习-(十四)SDK的安装
- Bada实现中对控件的删除。
- 开源Tizen系统视频泄露 酷似MeeGo及Bada
- 开源Tizen系统视频泄露 酷似MeeGo及Bada
- Hello Bada!详解之一:系统框架与生命周期
- QT的事件系统
- QT的事件系统
- QT的事件系统
- 手工打造编译器之词法分析器3
- HTML 元素
- 关于C中指针和数组的一点学习心得
- MFC Programming Notes 1
- POJ 1698 Alice's Chance ( EK )
- bada的系统事件
- Filter 失效问题
- 2010年10月4日魏晨粉丝正式曝光魏晨QQ号
- Starcraft2是非常优秀的hardcore游戏
- 10月3日正式发布真人秀制作教程,
- HTML 属性
- 二维数组的一些实验
- 怎样注册搜索引擎
- mysql导出与导入