[android]代码库
//注册广播
filter = new IntentFilter(SIGN);
registerReceiver(new Myreceiver2(), filter);
//接收广播
class Myreceiver2 extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if(SIGN.equals(intent.getAction())){
Toast.makeText(MainActivity.this,"发送退宿舍",Toast.LENGTH_SHORT).show();
init();
myadapter.notifyDataSetChanged();
}
}
}
//收到推送消息发送广播
Intent intent1 = new Intent(MainActivity.SIGN);
intent1.putExtra("tag", "");
MainApplication.context.sendBroadcast(intent1);
高级设计师
by: 小蜜锋 发表于:2017-02-23 17:20:03 顶(0) | 踩(0) 回复
回复评论