Example usage for android.content Intent putExtra

List of usage examples for android.content Intent putExtra

Introduction

In this page you can find the example usage for android.content Intent putExtra.

Prototype

@Deprecated
@UnsupportedAppUsage
public @NonNull Intent putExtra(String name, IBinder value) 

Source Link

Document

Add extended data to the intent.

Usage

From source file:Main.java

@SuppressWarnings("deprecation")
private static void closeBelowApiLevel17(Context context) throws Exception {
    Settings.System.putInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0);
    Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
    intent.putExtra("state", false);
    context.sendBroadcast(intent);/*from  www  . ja  va2 s  . c  o m*/
}

From source file:Main.java

/**
 * Notifies UI to display a message. This method is defined in the common
 * helper because it's used both by the UI and the background service.
 *
 * @param context The application context.
 * @param message The message to be displayed.
 *//*from   w  w  w . j  av a2  s  .  c o m*/
public static void displayMessage(Context context, String message) {
    Log.i(TAG, "displayMessage: " + message);
    Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
    intent.putExtra(EXTRA_MESSAGE, message);
    context.sendBroadcast(intent);
}

From source file:Main.java

public static Intent getCameraIntent(final Uri saveFileURI) {
    Intent mIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    return mIntent.putExtra(MediaStore.EXTRA_OUTPUT, saveFileURI);
}

From source file:Main.java

/**
 * Notifies UI to display a message. This method is defined in the common
 * helper because it's used both by the UI and the background service.
 *
 * @param context The application context.
 * @param message The message to be displayed.
 *///  ww  w  .  j  av a2  s.  com
public static void displayMessage(Context context, String message) {
    Log.i(TAG, "displayMessage(): " + message);
    Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
    intent.putExtra(EXTRA_MESSAGE, message);
    context.sendBroadcast(intent);
}

From source file:Main.java

public static Intent getCameraIntent(Uri saveFileURI) {
    Intent mIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    return mIntent.putExtra(MediaStore.EXTRA_OUTPUT, saveFileURI);
}

From source file:Main.java

public static void sedSMS(Context context, String phone) {
    Uri uri = Uri.parse("smsto:" + phone);
    Intent sendIntent = new Intent(Intent.ACTION_VIEW, uri);
    sendIntent.putExtra("sms_body", "");
    context.startActivity(sendIntent);//from  ww w .j  a v a  2s.c  o m
}

From source file:Main.java

public static void notifyPlayStateChanged(Context ctx, boolean playing, long position) {
    // The bluetooth stuff assumes STOP if playing == false && position = 0, PAUSE if
    // playing == false && position > 0, and PLAYING if playing == true
    Intent i = new Intent(AVRCP_PLAYSTATE_CHANGED);
    i.putExtra(KEY_PLAYING, playing);
    i.putExtra(KEY_POSITION, position);/*from   w w w  . j  ava2  s  . co  m*/

    ctx.sendBroadcast(i);
}

From source file:Main.java

/**
 * Notifies UI to display a message./*from  w w w .  j  a va  2  s  .  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 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

public static Intent webSearch(String query) {
    final Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
    intent.putExtra(SearchManager.QUERY, query);
    return intent;
}

From source file:Main.java

public static void editMessage(Context context, String phoneNumber, String msg) {
    Uri smsToUri = Uri.parse("smsto:" + phoneNumber);
    Intent msgIntent = new Intent(Intent.ACTION_SENDTO, smsToUri);
    msgIntent.putExtra("sms_body", msg);
    context.startActivity(msgIntent);/*from   ww  w.  j  a v a2  s. c o m*/
}