//本地广播,只能动态注册
mLocalBroadcastManager = LocalBroadcastManager.getInstance(this);
IntentFilter intentFilter = new IntentFilter();
//发出的是com.hbkj.android.yjq.mymoney.MY_CAST的广播
intentFilter.addAction("com.hbkj.android.yjq.mymoney.MY_CAST");
mMyBroadcastReceiver = new MyBroadcastReceiver();
mLocalBroadcastManager.registerReceiver(mMyBroadcastReceiver,intentFilter);
}
@Override
protected void onDestroy() {
super.onDestroy();
mLocalBroadcastManager.unregisterReceiver(mMyBroadcastReceiver);
}
android开发本地广播
最新推荐文章于 2024-04-28 18:50:09 发布