[Anroid Widget]问题集锦
来源:互联网 发布:2017数据录入员工资 编辑:程序博客网 时间:2024/06/06 03:34
1. updatePeriodMillis不执行
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minWidth="294dp" android:minHeight="72dp" android:updatePeriodMillis="86400000" android:previewImage="@drawable/preview" android:initialLayout="@layout/example_appwidget" android:configure="com.example.android.ExampleAppWidgetConfigure" android:resizeMode="horizontal|vertical"></appwidget-provider>
其中android:updatePeriodMillis的作用是设置更新频率, 单位是毫秒, 在实际使用中我用1000测试了一下,发现不执行。
public int updatePeriodMillisSince: API Level 3How often, in milliseconds, that this AppWidget wants to be updated. The AppWidget manager may place a limit on how often a AppWidget is updated.This field corresponds to the android:updatePeriodMillis attribute in the AppWidget meta-data file.Note: Updates requested with updatePeriodMillis will not be delivered more than once every 30 minutes.
查看了一下官方文档才知道, 要30分钟以上才行。 如果要执行30分钟以下频率的或者允许用户自己定义的,建议还是使用AlarmManager吧,此时可以将android:updatePeriodMillis设置为0。
2. 在Android4.0系统中onEnabled、onDisabled不执行
onEnabled:第一个组建创建时调用
onDisabled: 最后一个组建删除时调用
在2.1, 2.2, 2.3, ,2.3.3, 4.0.4平台上进行了测试, 在4.0.4平台上,创建第一个组建不会调用onEnabled,删除最后一个组建也不会调用onDisabled,只会调用OnUpdate; 其他平台正常!
3. 顺便说一下Widget预览图的设置(3.0以上才支持):
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" ... android:previewImage="@drawable/preview"></appwidget-provider>
属性列表对比:
(2.1)(4.0)
- [Anroid Widget]问题集锦
- [Anroid Widget]问题集锦
- cocos2d-x win32导成anroid工程大致流程,附小问题集锦
- Anroid 开发问题总汇
- anroid平台接入问题汇总
- ANROID SDK 搭建问题小结
- Anroid Handler 内存泄漏问题
- anroid
- 问题集锦
- 问题集锦
- 问题集锦
- 问题集锦
- 问题集锦
- 问题集锦
- 问题集锦
- 问题集锦
- 问题集锦
- 问题集锦
- hdoj 2398
- Map值按key排序或是按 value排序
- int 与integer
- 查询win32api内部实现
- 利用LocalConnection实现多个应用之间的通讯 (不同MXML之间的通信)
- [Anroid Widget]问题集锦
- uva488
- Profile Options In INV,PO,OM,MS/MRP
- DG保护模式切换中遇到的ORA-16072错误
- 服务器获取字节流并保存文件
- 缓存的运用
- Catalan数——卡特兰数
- 如何申请外网ip地址
- 程序员记