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

public static void removeShortCut(Context context, String appName, Intent tagIntent) {
    Intent intent = new Intent("com.android.launcher.action.UNINSTALL_SHORTCUT");
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, appName);
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, tagIntent);
    context.sendBroadcast(intent);/*from   w  w w .j a v a2 s.c o  m*/
}

From source file:Main.java

/**
 * Shortcut intent for icon on home screen.
 * @param url Url of the shortcut./* w  w w .  j  a v  a 2 s .c  o m*/
 * @return Intent for onclick action of the shortcut.
 */
public static Intent createShortcutIntent(String url) {
    Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    shortcutIntent.putExtra(REUSE_URL_MATCHING_TAB_ELSE_NEW_TAB, true);
    return shortcutIntent;
}

From source file:Main.java

public static void notifyMetaChanged(Context ctx, long id, String artist, String album, String track,
        int listSize, long duration, long position) {
    Intent i = new Intent(AVRCP_META_CHANGED);
    i.putExtra(KEY_ID, id);
    i.putExtra(KEY_ARTIST, artist);/* w  ww. j av  a2s.c om*/
    i.putExtra(KEY_ALBUM, album);
    i.putExtra(KEY_TRACK, track);
    i.putExtra(KEY_LIST_SIZE, listSize);
    i.putExtra(KEY_DURATION, duration);
    i.putExtra(KEY_POSITION, position);

    ctx.sendBroadcast(i);
}

From source file:Main.java

@NonNull
public static Intent sendSms(@NonNull String to, @NonNull String message) {
    final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("sms:" + to));
    intent.putExtra("sms_body", message);
    return intent;
}

From source file:Main.java

public static void goPageForResult(Activity context, int requstcode, Class<?> gopage, String extraName,
        String extraValue) {//  w  ww .j av  a  2 s .  c om
    Intent intent = new Intent(context, gopage);
    intent.putExtra(extraName, extraValue);
    context.startActivityForResult(intent, requstcode);
}

From source file:Main.java

public static void goPageForResult(Activity context, int requstcode, Class<?> gopage, String extraName,
        Parcelable extraValue) {/* w  w  w. j  a  v  a2  s.c om*/
    Intent intent = new Intent(context, gopage);
    intent.putExtra(extraName, extraValue);
    context.startActivityForResult(intent, requstcode);
}

From source file:Main.java

public static void goPageForResult(Activity context, int requstcode, Class<?> gopage, String extraName,
        int extraValue) {
    Intent intent = new Intent(context, gopage);
    intent.putExtra(extraName, extraValue);
    context.startActivityForResult(intent, requstcode);
}

From source file:Main.java

public static Intent getCameraIntent(String outputFile) {
    Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
    intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(outputFile)));
    return intent;
}

From source file:Main.java

public static void ask_for_payment(Context context, String payee_id, String annotation, String channel_id,
        String callback_url, int amount) {
    Intent intent = new Intent(CONFIRM_PAYMENT_ACTION);
    intent.putExtra("payee_id", payee_id);
    intent.putExtra("annotation", annotation);
    intent.putExtra("channel_id", channel_id);
    intent.putExtra("callback_url", callback_url);
    intent.putExtra("amount", amount);
    context.sendBroadcast(intent);//from w ww . j  a v a2s .c o  m
    Log.v(LOG_TAG, "send intent to main activity to confirm payment");
}

From source file:Main.java

/**
 * Notifies UI to display a message./*from  ww  w  .ja  va2  s  . c o  m*/
 * <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 displaySystemMessage(Context context, String message) {
    Intent intent = new Intent(SYSTEM_MESSAGE_ACTION);
    intent.putExtra(EXTRA_MESSAGE, message);
    context.sendBroadcast(intent);
}