摘要: 为什么要关闭组件?在用到组件时,有时候我们可能暂时性的不使用组件,但又不想把组件kill掉,比如创建了一个broadcastReceiver广播监听器,用来想监听第一次开机启动后获得系统的许多相关信息,并保存在文件中,这样以后每次开机启动就不需要再去启动该服务了,也就是说如果没有把receiver关闭掉,就算是不做数据处理,但程序却还一直在后台运行会消耗电量和内存,这时候就需要把这个receiver给关闭掉。如何关闭组件?关闭组件其实并不难,只要创建packageManager对象和ComponentName对象,并调用packageManager对象的setComponentEnabledS 阅读全文
posted @ 2011-03-18 21:59 S.Kei.Cheung 阅读(1747) 评论(0) 推荐(1) 编辑
摘要: Problem:When a notification is selected, Tabs activity is called passing the intent. I want to access the unique notificationId of the notification that was selected in Tabs. I tried intent.putExtra() to save the notificationId in the intent. But, for multiple notifications its overwriting the notif 阅读全文
posted @ 2011-03-18 14:33 S.Kei.Cheung 阅读(293) 评论(0) 推荐(0) 编辑
摘要: 前面说到intent的另外一种赋值方式:这个就是指定其component属性(调用setComponent(ComponentName)或者setClass(Context, Class)来指定)。通过这种方式的赋值的intent,其实就直接指出了activity类,这样就没有必要到androidmanfest.xml找provider,然后通过provider的gettype返回加上action来找activity了,而是直接创建activity类的实例。其实android还提供了一种创建activity的方式,那就是动态menu的方式,通过 1 public boolean onCreat 阅读全文
posted @ 2011-03-18 14:19 S.Kei.Cheung 阅读(665) 评论(0) 推荐(0) 编辑