Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.app.Activity;
import android.content.BroadcastReceiver;

import android.content.IntentFilter;
import android.support.v4.content.LocalBroadcastManager;

public class Main {

    public static void registBroadcase(Activity activity, BroadcastReceiver receiver, String name) {
        LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(activity);
        IntentFilter filter = new IntentFilter();
        filter.addAction(name);
        broadcastManager.registerReceiver(receiver, filter);
    }
}