第一个activity加入
/**
* 广播事件
*/
private void initBroadcast1() {
BroadcastReceiver mReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
// 刷新主Activity界面
}
};
IntentFilter intentFilter = new IntentFilter("image");
registerReceiver(mReceiver, intentFilter);
}
然后在onCrate中加入initBroadcast1()这个方法即可
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
unregisterReceiver(mReceiver);
}
第二个activity中加入
Intent intent = new Intent();
intent.setAction("image");//消息动作
CameraActivity.this.sendBroadcast(intent);
finish();