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

/**
 * @return an {@code Intent} to launch the given {@code packageName, name} with {@code replaceKey}.
 *///from w  ww .  ja  va2 s .c  o m
public static Intent createMushroomLaunchingIntent(String packageName, String name, String replaceKey) {
    Intent intent = new Intent(ACTION);
    intent.setComponent(new ComponentName(packageName, name));
    intent.addCategory(CATEGORY);
    intent.putExtra(KEY, replaceKey);
    return intent;
}

From source file:Main.java

/**
 * When adding account//  w  w  w  . ja  v  a2 s. c o m
 * open the same UI screen for user to choose account
 */
public static Intent getIntentForAddingAccount() {
    final Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    intent.putExtra(Settings.EXTRA_AUTHORITIES, new String[] { ContactsContract.AUTHORITY });
    return intent;
}

From source file:Main.java

public static Intent actionNewAccountIntent(final Context context) {
    final Intent i = new Intent();
    i.setComponent(new ComponentName(context, "com.android.email.activity.setup.AccountSetupFinal"));
    i.putExtra(EXTRA_FLOW_MODE, FLOW_MODE_NORMAL);
    return i;/*from  www  .j av  a  2  s  .co m*/
}

From source file:Main.java

public static Intent createOpenCalendarEventIntent(int eventId, DateTime from, DateTime to) {
    Intent intent = createCalendarIntent(Intent.ACTION_VIEW);
    intent.setData(ContentUris.withAppendedId(Events.CONTENT_URI, eventId));
    intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, from.getMillis());
    intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, to.getMillis());
    return intent;
}

From source file:Main.java

public static void addToPocket(Context context, String url, String tweetStatusId) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setPackage(PACKAGE);/*from ww  w  . j  a va2s .co  m*/
    intent.setType(MIME_TYPE);

    intent.putExtra(Intent.EXTRA_TEXT, url);
    if (tweetStatusId != null && tweetStatusId.length() > 0) {
        intent.putExtra(EXTRA_TWEET_STATUS_ID, tweetStatusId);
    }
    intent.putExtra(EXTRA_SOURCE_PACKAGE, context.getPackageName());
    context.startActivity(intent);
}

From source file:Main.java

/**
 * @brief      Get the intent to add telephone number into contact. 
 *
 * @par        Sync (or) Async://from ww  w. ja va 2s.  c  om
 * This is a Synchronous function.
 *
 * @param [IN] telNumber    Telephone number.\n
 * 
 * @return     
 *
 * @author     daiping.zhao
 * @since      1.0.0.0
 * @version    1.0.0.0
 * @par        Prospective Clients:
 * External Classes
 */
public static Intent doAddTelToExistContact(String telNumber) {
    Intent newIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT, Contacts.CONTENT_URI);
    newIntent.setType(Contacts.CONTENT_ITEM_TYPE);
    newIntent.putExtra(Intents.Insert.PHONE, telNumber);
    return newIntent;
}

From source file:Main.java

public static Intent actionNewAccountWithResultIntent(final Context context) {
    final Intent i = new Intent();
    i.setComponent(new ComponentName(context, "com.android.email.activity.setup.AccountSetupFinal"));
    i.putExtra(EXTRA_FLOW_MODE, FLOW_MODE_NO_ACCOUNTS);
    return i;// w w  w . j  a  va2 s .  c  o m
}

From source file:Main.java

/**
 * @brief      Get the intent to add email address to existed contact.
 *
 * @par        Sync (or) Async:/*from  w  w w.  ja v  a 2 s.co  m*/
 * This is a Synchronous function.
 *
 * @param [IN] email    email address.\n
 * 
 * @return     
 *
 * @author     daiping.zhao
 * @since      1.0.0.0
 * @version    1.0.0.0
 * @par        Prospective Clients:
 * External Classes
 */
public static Intent doAddEmaliToExistContact(String email) {
    Intent newIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT, Contacts.CONTENT_URI);
    newIntent.setType(Contacts.CONTENT_ITEM_TYPE);
    newIntent.putExtra(Intents.Insert.EMAIL, email);
    return newIntent;
}

From source file:Main.java

public static void applyPermission(Context context) {
    Intent intent = new Intent("com.meizu.safe.security.SHOW_APPSEC");
    intent.setClassName("com.meizu.safe", "com.meizu.safe.security.AppSecActivity");
    intent.putExtra("packageName", context.getPackageName());
    context.startActivity(intent);//from   w w  w .j  a va 2  s .c  om
}

From source file:Main.java

private static void clearBadgeSony(Context context) {
    String launcherClassName = getLauncherClassName(context);
    if (launcherClassName == null) {
        return;//  ww w .j a  v a2  s . c  o  m
    }

    Intent intent = new Intent();
    intent.setAction("com.sonyericsson.home.action.UPDATE_BADGE");
    intent.putExtra("com.sonyericsson.home.intent.extra.badge.ACTIVITY_NAME", launcherClassName);
    intent.putExtra("com.sonyericsson.home.intent.extra.badge.SHOW_MESSAGE", false);
    intent.putExtra("com.sonyericsson.home.intent.extra.badge.MESSAGE", String.valueOf(0));
    intent.putExtra("com.sonyericsson.home.intent.extra.badge.PACKAGE_NAME", context.getPackageName());

    context.sendBroadcast(intent);
}