摘要: 1.静态注册。在manifest中注册。1 然后在activity中使用sendBroadcast(Intent)方法。其中参数是Intent.1 Intent intent=new Intent(this,MyReceiver.class);2 intent.putExtra("data", "e... 阅读全文
posted @ 2015-07-11 22:33 熠然 阅读(1876) 评论(0) 推荐(0) 编辑
摘要: 在Android5.0以前可以通过隐式Intent方式启动其他App的Service,就跟Activity启动隐式Intent一样的。但是在5.0以后,只能使用显示的Intent方式启动了。启动其他App的Service,需要用到Intent的setComponent()方法。该方法需要传入Comp... 阅读全文
posted @ 2015-07-11 17:50 熠然 阅读(5971) 评论(0) 推荐(0) 编辑
摘要: 在Android开发之bindService()通信的基础上,实现bindService()方法侦听service内部状态。实现侦听service内部状态,使用的是回调机制1.首先实现一个接口1 public static interface CallBack{2 void... 阅读全文
posted @ 2015-07-11 16:15 熠然 阅读(1189) 评论(0) 推荐(0) 编辑
摘要: Service 启动方式有两种 startService(intent) bindService(intent,conn,Context.BIND_AUTO_CREATE) startService(intent) 生命周期: onCreate()- >onStartCommand()->start 阅读全文
posted @ 2015-07-11 15:34 熠然 阅读(9203) 评论(0) 推荐(0) 编辑
摘要: 转自:Android AsyncTask完全解析,带你从源码的角度彻底理解 另外一篇比较详细的博文:http://blog.csdn.net/liuhe688/article/details/6532519 http://stackoverflow.com/questions/9671546/asy 阅读全文
posted @ 2015-07-11 13:13 熠然 阅读(721) 评论(0) 推荐(0) 编辑
摘要: 更加详细的介绍Handler的博文-http://blog.csdn.net/guolin_blog/article/details/9991569Android中的异步消息处理主要有四个部分组成,Message, Handler, MessageQueue和 Looper.1.Message。在线... 阅读全文
posted @ 2015-07-11 11:32 熠然 阅读(627) 评论(0) 推荐(0) 编辑
摘要: 转自第一行代码-AndroidAndroid是不允许在子线程中进行UI操作的。在子线程中去执行耗时操作,然后根据任务的执行结果来更新相应的UI控件,需要用到Android提供的异步消息处理机制。代码如下: 1 public class MainActivity extends Activity im... 阅读全文
posted @ 2015-07-11 11:15 熠然 阅读(1516) 评论(0) 推荐(0) 编辑