在上一篇博文中简单介绍了一下BroadcastReceiver的相关知识点,本篇举一个在代码中动态的注册.注销BroadcastReceiver的栗子. 1.首先创建一个MyReceiver并继承BroadcastReceiver,既然要动态注册该receiver的话,就无需在AndroidManifest.xml中配置它了: public class MyReceiver extends BroadcastReceiver { public static final String ACTION…