hello i am trying to attach a text file to send it with an email but when opening the email interface it says file does'not exist while it's really exist on the phone storage here's the code
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, "report gps location");
i.putExtra(Intent.EXTRA_TEXT , "body of email");
i.putExtra(Intent.EXTRA_STREAM, Uri.parse(Environment.getExternalStorageDirectory().getAbsolutePath() + "/folderName/file.txt"));
try
{
startActivity(Intent.createChooser(i, "Send mail..."));
}
catch (android.content.ActivityNotFoundException ex)
{
Toast.makeText(getBaseContext(), "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}