我在android上工作,试图发送带有附加文件的电子邮件,但出现以下错误。将PDF文件附加到应用程序的电子邮件
android.content.ActivityNotFoundException:无活动处理 意向{行动= android.intent.action.SENDTO DAT =文件://assets/Cards/myfile.pdf典型值=应用程序/ PDF FLG = 0x10000000的 (有演员)}
林Android开发人员因此Im有点儿丢失什么,我需要做的非常新。以下是我目前正在尝试的内容
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);
我可以在不附加文件的情况下正常创建和发送电子邮件。我如何应安装文件中的任何帮助,正确地将是巨大的感谢
在真正的设备NOT IN EMULATOR测试它。如果这没有帮助,然后尝试设置intent.setType(“application/pdf”);并看到结果。 –
是啊我一直在设备上测试,并尝试设置应用程序/ pdf,但它给了我相同的错误 – glogic
尝试设置您的意图Intent.ACTION_SEND。正确的PDF文件的MIME类型是“application/pdf”而不是“Applications/pdf” –