代码语言:javascript
复制sendBroadcast(new Intent("和接收广播的地方要一致"));
代码语言:javascript
复制 class RefreshReciver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
//你自己要做的操作
refresh();
}
}
代码语言:javascript
复制 @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_jump);
initView();
reciver = new RefreshReciver();
registerReceiver(reciver, new IntentFilter("和接收广播的地方要一致"));
}
代码语言:javascript
复制 @Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(reciver);
}