Im working on android and trying to send an email with a file attached but getting the following error.
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SENDTO dat=file://assets/Cards/myfile.pdf typ=Applications/pdf flg=0x10000000 (has extras) }
Im very new to android dev so Im kinda lost as to what i need to do . Below is what I am currently trying
Intent intent = new Intent(Intent.ACTION_SENDTO ); // it's not ACTION_SEND
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "Card Set "));
intent.putExtra(Intent.EXTRA_TEXT, "");
intent.setData(Uri.parse("mailto:"));
intent.setDataAndType(Uri.parse("file://assets/Cards/" + "myfile.pdf"),
"Applications/pdf");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intent);
I can create and send emails fine without attaching a file. Any help on how i should be attaching file correctly would be great thanks