Local Broadcast Receiver

PHOTO EMBED

Thu Nov 18 2021 08:40:38 GMT+0000 (UTC)

Saved by @IrtiqaMohiuddin #java

Fire Event:

Intent intent = new Intent(YOUR_EVENT_NAME);
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);

Receive Event:

LocalBroadcastManager.getInstance(context).registerReceiver(receiverName,
new IntentFilter(YOUR_EVENT_NAME));

private BroadcastReceiver receiverName = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
          
        }
};
content_copyCOPY