2009年9月16日
摘要: 在地震例子中,这一次的修改你将使用Alarm来替代Timer,定期执行网络更新。 1. 创建一个新的EarthquakeAlarmReceiver类,扩展BroadcastReceiver。 package com.paad.earthquake; import android.content.BroadcastReceiver; import android.content.Context;... 阅读全文
posted @ 2009-09-16 22:54 xirihanlin 阅读(605) 评论(0) 推荐(0) 编辑
摘要: Alarm是在预定的时间上触发Intent的一种独立的方法。 Alarm超出了应用程序的作用域,所以它们可以用于触发应用程序事件或动作,甚至在应用程序关闭之后。与Broadcast Receiver结合,它们可以变得尤其的强大,可以通过设置Alarm来启动应用程序或者执行动作,而应用程序不需要打开或者处于活跃状态。 举个例子,你可以使用Alarm来实现一个闹钟程序,执行正常的网络查询,或者在... 阅读全文
posted @ 2009-09-16 22:11 xirihanlin 阅读(2444) 评论(0) 推荐(0) 编辑