List of usage examples for android.content Intent ACTION_SEND
String ACTION_SEND
To view the source code for android.content Intent ACTION_SEND.
Click Source Link
From source file:Main.java
public static void sendEmail(Context ctx, String[] emailAddresses, String[] CCAddresses, String subject, String message) {//from ww w.j a v a2s . co m Intent emailIntent = new Intent(Intent.ACTION_SEND); // emailIntent.setType("text/plain"); emailIntent.setData(Uri.parse("mailto:")); String[] to = emailAddresses; String[] cc = CCAddresses; emailIntent.putExtra(Intent.EXTRA_EMAIL, to); if (CCAddresses != null) { emailIntent.putExtra(Intent.EXTRA_CC, cc); } emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_TEXT, message); emailIntent.setType("message/rfc822"); ctx.startActivity(Intent.createChooser(emailIntent, "Email")); }
From source file:Main.java
/** * Drafts an email to the given email address, with the given subject line and message * @param context// w w w.ja v a 2 s . c o m * @param emailAddress * @param subject * @param message */ public static void emailDeveloper(Context context, String emailAddress, String subject, String message) { Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL, new String[] { emailAddress }); i.putExtra(Intent.EXTRA_SUBJECT, subject); i.putExtra(Intent.EXTRA_TEXT, message); context.startActivity(i); }
From source file:Main.java
public static Intent getAndroidShareIntent(CharSequence chooseTitle, CharSequence subject, CharSequence content) {/* ww w .j a v a 2 s.com*/ Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_SUBJECT, subject); shareIntent.putExtra(Intent.EXTRA_TEXT, content); return Intent.createChooser(shareIntent, chooseTitle); }
From source file:Main.java
/** * Creates a intent with an image// www . ja v a 2s .c o m * * @param image * @return */ public static Intent createIntentFromImage(File image) { Intent share = new Intent(Intent.ACTION_SEND); share.setType("image/*"); return share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(image)); }
From source file:Main.java
/** * Share the crisis with your friend and/or the world. *//*from www . ja va2s. c o m*/ public static Intent shareCrisis(String crisisID, String shortTitle) { Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("text/plain"); StringBuffer shareContent = new StringBuffer(); shareContent.append(shortTitle); shareContent.append(" - "); shareContent.append("http://www.sigimera.org/crises/"); shareContent.append(crisisID); shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareContent.toString()); return shareIntent; }
From source file:Main.java
public static void sendEmail(Context context, String chooserTitle, String mailAddress, String subject, String preContent) {/*from w w w . ja v a 2 s. co m*/ final Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { mailAddress }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); String content = "\n\n=====================\n"; content += "Device Environment: \n----\n" + preContent; emailIntent.putExtra(Intent.EXTRA_TEXT, content); context.startActivity(Intent.createChooser(emailIntent, chooserTitle)); }
From source file:Main.java
public static Intent getSendIntent(Context context, String title, String text) { if (TextUtils.isEmpty(text)) throw new IllegalArgumentException("text cannot be empty or null"); if (TextUtils.isEmpty(title)) throw new IllegalArgumentException("title cannot be empty or null"); Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, text); sendIntent.setType("text/plain"); return Intent.createChooser(sendIntent, title); }
From source file:Main.java
@SuppressLint("InlinedApi") public static void launchPlainText(Context context, String text, CharSequence chooserTitle) { // See http://android-developers.blogspot.com/2012/02/share-with-intents.html Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); intent.putExtra(Intent.EXTRA_TEXT, text); // intent.putExtra( Intent.EXTRA_SUBJECT, subject ); // intent.putExtra( Intent.EXTRA_EMAIL, new String[] { emailTo } ); context.startActivity(Intent.createChooser(intent, chooserTitle)); }
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 w ww. j a v a 2s. c om*/ 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
public static void share(Context pContext, String urlToShare, String titleChosser, String subject) { Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, urlToShare); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); pContext.startActivity(Intent.createChooser(intent, titleChosser)); }