Possible duplicate:
Email from internal storage
The letter is received by the recipient, but without attachment. Here is the code, does any expert know where I made a mistake?
Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] {"email@example.com"}); intent.putExtra(Intent.EXTRA_SUBJECT, "subject here"); intent.putExtra(Intent.EXTRA_TEXT, "body text"); File root = Environment.getExternalStorageDirectory(); File file = new File(root, xmlFilename); if (!file.exists() || !file.canRead()) { Toast.makeText(this, "Attachment Error", Toast.LENGTH_SHORT).show(); finish(); return; } Uri uri = Uri.parse("file://" + file); intent.putExtra(Intent.EXTRA_STREAM, uri); startActivity(Intent.createChooser(intent, "Send email..."));
I do not receive a message with toasts. Thank.
java android android-intent attachment
Mr Jackson May 20 '11 at 22:15 2011-05-20 22:15
source share