Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v4.content.LocalBroadcastManager; public class Main { public static void sendLocalBroadcast(Context context, Intent intent) { LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context); lbm.sendBroadcast(intent); } public static void sendLocalBroadcast(Context context, String action) { Intent intent = new Intent(action); LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context); lbm.sendBroadcast(intent); } public static void sendBroadcast(Context context, Intent intent) { context.sendBroadcast(intent); } public static void sendBroadcast(Context context, String action) { Intent intent = new Intent(action); context.sendBroadcast(intent); } public static void sendBroadcast(Context context, String action, Bundle data) { Intent intent = new Intent(action); intent.putExtras(data); context.sendBroadcast(intent); } public static void sendBroadcast(Context context, String packageName, String action) { Intent intent = new Intent(action); intent.setPackage(packageName); context.sendBroadcast(intent); } }