register Local Intent Receiver - Android Intent

Android examples for Intent:Broadcast

Description

register Local Intent Receiver

Demo Code


//package com.java2s;

import android.content.BroadcastReceiver;
import android.content.Context;

import android.content.IntentFilter;

import android.support.v4.content.LocalBroadcastManager;

public class Main {
    public static void registerLocalReceiver(Context context,
            BroadcastReceiver receiver, IntentFilter intentFilter) {
        if (context == null) {
            return;
        }//from  ww  w  .  j  a  v  a 2s . c o m

        LocalBroadcastManager manager = LocalBroadcastManager
                .getInstance(context);
        manager.registerReceiver(receiver, intentFilter);
    }
}

Related Tutorials