从A类跳转到B类,B类有个发送广播的按钮!第一次发送广播,在fragment中接收并执行b操作!当我退到A类,再跳转B类后,再点击按钮发送那个广播,在fragment中会执行两次b操作!我退三次,就会执行三次b操作!
这是怎么回事呢?
代码如下:
B类中发送广播:
Intent inten = new Intent("android.intent.action.Fa");
LocalBroadcastManager.getInstance(CommodityActivity.this).sendBroadcast(inten);
侧滑fragment接收广播:
LocalBroadcastManager broadcastManager2 = LocalBroadcastManager.getInstance(getActivity());
IntentFilter intentFilter2 = new IntentFilter();
intentFilter2.addAction("android.intent.action.guafff");
BroadcastReceiver mItemViewListClickReceiver2 = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent inten) {
b操作
}
};
broadcastManager2.registerReceiver(mItemViewListClickReceiver2, intentFilter2);
就这么多,我还该怎么改过来?求大神解答,甚急!甚急!!
无悬赏金币,可加QQ:379077640!需要的话,必有感谢!