Sends out a broadcast leveraging LocalBroadcastManager for Intent - Android Intent

Android examples for Intent:Broadcast

Description

Sends out a broadcast leveraging LocalBroadcastManager for Intent

Demo Code


//package com.java2s;

import android.content.Context;
import android.content.Intent;

import android.support.annotation.NonNull;
import android.support.v4.content.LocalBroadcastManager;

public class Main {
    /**//from w ww  .j a  v a 2  s  .  co  m
     * Sends out a broadcast leveraging {@link LocalBroadcastManager}
     *
     * @param context used to get the instance of the {@link LocalBroadcastManager}.
     * @param intent  the intent to send to the {@link BroadcastReceiver}.
     */
    public static void sendBroadcast(@NonNull Context context,
            @NonNull Intent intent) {
        LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
    }
}

Related Tutorials