Example usage for android.content Context sendBroadcast

List of usage examples for android.content Context sendBroadcast

Introduction

In this page you can find the example usage for android.content Context sendBroadcast.

Prototype

public abstract void sendBroadcast(@RequiresPermission Intent intent);

Source Link

Document

Broadcast the given intent to all interested BroadcastReceivers.

Usage

From source file:Main.java

public static void displayMessage(Context context, String message) {
    Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
    intent.putExtra(EXTRA_MESSAGE, message);
    context.sendBroadcast(intent);
}

From source file:ru.yandex.subtitles.ui.appwidget.AbstractAppWidget.java

public static void notifyDataSetChanged(final Context context) {
    context.sendBroadcast(new Intent(ACTION_APPWIDGET_DATASET_CHANGED));
}

From source file:Main.java

/**
 * @param message to open the camera./*from w  w w.  j  a v  a2  s  .com*/
 *  
 *  
 */
static void displayImage(Context context, String message) {
    Intent intent = new Intent(DISPLAY_IMAGE_ACTION);

    intent.getAction();
    context.sendBroadcast(intent);
}

From source file:Main.java

public static void sendBroadcast(Context context, String action, Bundle data) {
    Intent intent = new Intent(action);
    intent.putExtras(data);//from   w w w .  j a  v a  2s.c om
    context.sendBroadcast(intent);
}

From source file:Main.java

/**
 * Notifies UI to display a message./*  w w w. j  a v  a 2 s.  c  om*/
 * <p>
 * This method is defined in the common helper because it's used both by
 * the UI and the background service.
 *
 * @param context application's context.
 * @param message message to be displayed.
 */
static void displayMessage(Context context, Bundle extras) {
    Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
    intent.putExtras(extras);
    context.sendBroadcast(intent);
}

From source file:Main.java

static public void changeStatusIcon(Context context, int iconResID) {
    Intent intent = new Intent("at.sprinternet.odm.STATUS_CHANGED");
    intent.putExtra("statusImageID", iconResID);
    context.sendBroadcast(intent);
}

From source file:Main.java

public static final void sendToDeleteSearchResultItemData(Context context, String time) {
    Intent intent = new Intent();
    intent.setAction(HOMELIST_DELETE);//from  www.j ava 2s.c om
    intent.putExtra(SEARCH_TIME, time);
    context.sendBroadcast(intent);
}

From source file:Main.java

/**
 * Notifies UI to display a message./*from  ww  w  .j  av a 2 s  .c  om*/
 * 
 * This method is defined in the common helper because it's used both by the
 * UI and the background service.
 * 
 * @param context
 *            application's context.
 * @param message
 *            message to be displayed.
 */
static void displayMessage(Context context, String message) {
    Intent intent = new Intent("com.nowsci.odm.DISPLAY_MESSAGE");
    intent.putExtra("message", message);
    context.sendBroadcast(intent);
}

From source file:Main.java

/**
 * Notifies UI to display a message.//from   w ww  . j  a  v a2s. c  o m
 * 
 * This method is defined in the common helper because it's used both by the
 * UI and the background service.
 * 
 * @param context
 *            application's context.
 * @param message
 *            message to be displayed.
 */
static public void displayMessage(Context context, String message) {
    Intent intent = new Intent("at.sprinternet.odm.DISPLAY_MESSAGE");
    intent.putExtra("message", message);
    context.sendBroadcast(intent);
}

From source file:Main.java

public static void sendBroadcast(Context context, String packageName, String action) {
    Intent intent = new Intent(action);
    intent.setPackage(packageName);//w  w  w .  ja  va2  s  . c o  m
    context.sendBroadcast(intent);
}