List of usage examples for android.content Intent putExtra
@Deprecated
@UnsupportedAppUsage
public @NonNull Intent putExtra(String name, IBinder value)
From source file:Main.java
public static Intent getAddToContactIntent(CharSequence name, CharSequence phoneNumber, int phoneNumberType) { Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); intent.putExtra(Intents.Insert.PHONE, phoneNumber); // Only include the name and phone type extras if they are specified (the method // getAddNumberToContactIntent does not use them). if (name != null) { intent.putExtra(Intents.Insert.NAME, name); }//from w w w . j a va 2 s. c om if (phoneNumberType != -1) { intent.putExtra(Intents.Insert.PHONE_TYPE, phoneNumberType); } intent.setType(Contacts.CONTENT_ITEM_TYPE); return intent; }
From source file:Main.java
public static void shareText(Context context, String title, String text) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, title); intent.putExtra(Intent.EXTRA_TEXT, text); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);// Intent.createChooser(intent, title) }
From source file:Main.java
public static Intent sendSms(String to, 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 sendBrodcast(Context context, String action, String content) { if (TextUtils.isEmpty(action) || context == null) { return;/* w ww .j a v a 2 s .c o m*/ } Intent intent = new Intent(); intent.setAction(action); intent.putExtra("extra", content); context.sendBroadcast(intent); }
From source file:Main.java
public static void sendBrodcast(Context context, String action, Bundle bundle) { if (TextUtils.isEmpty(action) || context == null) { return;/*w ww . ja v a 2 s . c o m*/ } Intent intent = new Intent(); intent.setAction(action); intent.putExtra("extra", bundle); context.sendBroadcast(intent); }
From source file:Main.java
public static void sendBroadcast(Context context, String filter, String name, Serializable serializable) { Intent intent = new Intent(); intent.putExtra(name, serializable); intent.setAction(filter);// w w w . java 2 s .c o m context.sendBroadcast(intent); }
From source file:Main.java
public static void sendBroadcast(Context context, String filter, String name, String value) { Intent intent = new Intent(); intent.putExtra(name, value); intent.setAction(filter);// w ww.ja v a2 s .com context.sendBroadcast(intent); }
From source file:Main.java
public static void sendBroadcast(Context context, String filter, String name, long value) { Intent intent = new Intent(); intent.putExtra(name, value); intent.setAction(filter);//ww w. j a va 2 s . c om context.sendBroadcast(intent); }
From source file:Main.java
public static void sendBroadcast(Context context, String filter, String name, int value) { Intent intent = new Intent(); intent.putExtra(name, value); intent.setAction(filter);/* w ww. jav a 2 s. c o m*/ context.sendBroadcast(intent); }
From source file:Main.java
public static void sendIconCountMessage(Context mContext, int num) { Intent i = new Intent("android.intent.action.APPLICATION_MESSAGE_UPDATE"); i.putExtra("android.intent.extra.update_application_component_name", "com.xiaomi.alertsystem/.ui.LogoActivity"); String s = ""; if (num > 0) { if (num > 99) s = "99+"; else//from ww w. j a v a 2 s.c o m s = "" + num; i.putExtra("android.intent.extra.update_application_message_text", s); } mContext.sendBroadcast(i); }