设为首页 加入收藏

TOP

Android 定时器的使用(二)
2015-08-31 21:25:31 来源: 作者: 【 】 浏览:672
Tags:Android 定时器 使用
i,Intent intent,int j)方法;如果是通过广播来实现闹钟提示的话,PendingIntent对象的获取就应该采用 PendingIntent.getBroadcast(Context c,int i,Intent intent,int j)方法;如果是采用Activity的方式来实现闹钟提示的话,PendingIntent对象的获取就应该采用 PendingIntent.getActivity(Context c,int i,Intent intent,int j)方法。如果这三种方法错用了的话,虽然不会报错,但是看不到闹钟提示效果。


4.上面代码中
?RecommendService.class
类的具体内容:


public class RecommendService extends IntentService? {


? ? @Override
? ? protected void onHandleIntent(Intent intent) {
? ? ? ?
? ? ? ? }


}? ?


该intentService的优势在于会按顺序执行被定时器多次启动的发送过来的intent的操作,并且耗时的intent操作不用在新建子线程,因为intentSevice已经为每个intent建立workThread。


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇是时候升级你的gulp到4.0了 下一篇Bash中单引号和双引号的区别

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: