标签:
Intent intent = new Intent();
intent.setAction("cn.abel.action.broadcast");
intent.putExtra("trainingID", article.trainingID);
// 发送 一个无序广播
_activity.sendBroadcast(intent);
private class MyBroadcastReciver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals("cn.abel.action.broadcast")) {
cateID = intent.getStringExtra("cateID");
}
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bbsdetail);
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("cn.abel.action.broadcast");
BBSDetailActivity.this.registerReceiver(new MyBroadcastReciver(), intentFilter);
}
标签:
原文地址:http://www.cnblogs.com/ruiati/p/4760820.html