Advertisement
Guest User

Untitled

a guest
Jun 25th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "testemail@gmail.com", null)); startActivity(intent);
  2.  
  3. /* Create the Intent */
  4. final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
  5.  
  6. /* Fill it with Data */
  7. emailIntent.setType("plain/text");
  8. emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"to@email.com"});
  9. emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
  10. emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Text");
  11.  
  12. /* Send it off to the Activity-Chooser */
  13. context.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
  14.  
  15. Intent intent = new Intent(
  16. Intent.ACTION_SENDTO,
  17. Uri.parse("mailto:testemail@gmail.com")
  18. );
  19. startActivity(intent);
  20.  
  21. ComponentName emailApp = intent.resolveActivity(getPackageManager());
  22. ComponentName unsupportedAction = ComponentName.unflattenFromString("com.android.fallback/.Fallback");
  23. boolean hasEmailApp = emailApp != null && !emailApp.equals(unsupportedAction);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement