Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

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

import android.support.v4.content.LocalBroadcastManager;

public class Main {
    private static LocalBroadcastManager mLocalBroadcastManager;

    public static void unRegisterBroadcastReceiver(Context context, BroadcastReceiver broadcastReceiver) {
        if (context != null && broadcastReceiver != null) {
            if (mLocalBroadcastManager == null) {
                getLocalBroadcastManager(context.getApplicationContext());
            }
            mLocalBroadcastManager.unregisterReceiver(broadcastReceiver);
        }
    }

    private static void getLocalBroadcastManager(Context context) {
        mLocalBroadcastManager = LocalBroadcastManager.getInstance(context);
    }
}