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 sendMail(Context context, String dstAddr, String subject, String text) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); String[] address = { dstAddr }; emailIntent.putExtra(Intent.EXTRA_EMAIL, address); emailIntent.setType("message/rfc822"); emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_TEXT, text); context.startActivity(Intent.createChooser(emailIntent, "Send mail...")); }
From source file:Main.java
public static void shareToOtherApp(Context context, String title, String content, String dialogTitle) { Intent intentItem = new Intent(Intent.ACTION_SEND); intentItem.setType("text/plain"); intentItem.putExtra(Intent.EXTRA_SUBJECT, title); intentItem.putExtra(Intent.EXTRA_TEXT, content); intentItem.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(Intent.createChooser(intentItem, dialogTitle)); }
From source file:Main.java
public static void shareText(Context context, String title, String subject, String text, String mime) { Intent share = new Intent(Intent.ACTION_SEND); share.setType(mime);/* w w w.ja v a 2s . c o m*/ share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET | Intent.FLAG_ACTIVITY_NEW_DOCUMENT); // Add data to the intent, the receiving app will decide // what to do with it. share.putExtra(Intent.EXTRA_SUBJECT, subject); share.putExtra(Intent.EXTRA_TEXT, text); context.startActivity(Intent.createChooser(share, title)); }
From source file:Main.java
public static Intent newEmailIntent(Context context, String address, String subject, String body, String cc) { Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { address }); intent.putExtra(Intent.EXTRA_TEXT, body); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_CC, cc); intent.setType("message/rfc822"); return intent; }
From source file:Main.java
public static boolean share(Context context, String title, String content) { Intent send = new Intent(Intent.ACTION_SEND); send.setType("text/plain"); send.putExtra(Intent.EXTRA_TEXT, content); send.putExtra(Intent.EXTRA_SUBJECT, title); try {/* w w w.ja va 2 s. c o m*/ context.startActivity(Intent.createChooser(send, content)); } catch (android.content.ActivityNotFoundException ex) { return false; } return true; }
From source file:Main.java
public static void sendEmail(String email, Context context) { Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); String aEmailList[] = { email }; emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList); emailIntent.setType(PLAIN_TEXT);//from www. ja va 2s. c o m context.startActivity(emailIntent); }
From source file:Main.java
public static void shareImage(Context context, Uri uri, String title) { Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); shareIntent.setType("image/jpeg"); context.startActivity(Intent.createChooser(shareIntent, title)); }
From source file:Main.java
/** * Returns import source uri based on the Intent. *//*from ww w .ja v a 2 s .c o m*/ static Uri getImportUri(Intent intent) { String action = intent.getAction(); if (Intent.ACTION_SEND.equals(action)) { return intent.getParcelableExtra(Intent.EXTRA_STREAM); } if (Intent.ACTION_VIEW.equals(action)) { return intent.getData(); } return null; }
From source file:Main.java
public static void shareContent(Context context, String subject, String summary, String url) { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, url); context.startActivity(Intent.createChooser(intent, "Share")); }
From source file:Main.java
public static void sendText(Activity context, String text) { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); // sendIntent.putExtra(Intent.EXTRA_TEXT, text); // sendIntent.setType("text/plain"); context.startActivity(Intent.createChooser(sendIntent, text)); }