android: attaching file to mail
android, android-intent, email-attachments
Solution
Try this:
i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/MyFile.csv"));
And make sure you have required permissions to access external storage.
Problem
i have this code for sending mail: ``` Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_EMAIL , new String[]{"MyMail@gmail.com"}); i.putExtra(Intent.EXTRA_SUBJECT, "subject of email"); i.putExtra(Intent.EXTRA_TEXT , "body of email"); try { startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(BladeActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } ``` how to attach to this mail the file: `/sdcard/MyFile.csv` thanks,