广播使用方式

xiaoxiao2021-02-28  30

/** * 发送广播,通知UI层有新的消息 */ private static void sendNewIsReadBroadcast(Context context) { Intent intent = new Intent(); intent.setAction(Constants.NEW_ISREAD_ACTION); context.sendBroadcast(intent); Log.e("发送了吗"); }

private void initYJLJXX(){        // wcl.updatadb();         registerYJLJRec();     }    private void registerYJLJRec() {         receiver2 = new UpdateBroadcastReceiver();         IntentFilter filter = new IntentFilter(ConstantsAction.NEW_ISREAD_ACTION);         registerReceiver(receiver2, filter);     }     public static class UpdateUserInfoBroadcastReceiver extends BroadcastReceiver {         @Override         public void onReceive(Context context, Intent intent) {             wcl.updatadb();         }     }
转载请注明原文地址: https://www.6miu.com/read-2800182.html

最新回复(0)