我尝试使用意图操作文件不会打开,但我不能为PDF和图片文件文件和图像文件中的android
对于图像所有的应用程序要崩溃(包括库的应用程序)
对DOC/DOCX我使用的办公套件,但给出了包(了java.lang.RuntimeException)运行时异常。请参阅下面的代码:
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(Intent.ACTION_VIEW);
if (extension.equalsIgnoreCase("jpg")
| extension.equalsIgnoreCase("jpeg")
| extension.equalsIgnoreCase("png")
| extension.equalsIgnoreCase("bitmap")) {
intent.setDataAndType(Uri.parse(fileName), "image/*");
} else if (extension.equalsIgnoreCase("xml")
| extension.equalsIgnoreCase("txt")
| extension.equalsIgnoreCase("csv")) {
intent.setDataAndType(Uri.parse(fileName), "text/*");
} else if (extension.equalsIgnoreCase("mp4")
| extension.equalsIgnoreCase("3gp")) {
intent.setDataAndType(Uri.parse(fileName), "video/*");
} else if (extension.equalsIgnoreCase("pdf")) {
intent.setDataAndType(Uri.parse(fileName), "application/pdf");
System.out.println("Pdf file to open "+fileName);
} else if (extension.equalsIgnoreCase("doc")
| extension.equalsIgnoreCase("docx")) {
intent.setDataAndType(Uri.parse(fileName), "application/word");
}
context.startActivity(intent);
但是,如果我试图通过去文件资源管理器打开这些文件都正确打开文件。
您可以发布您的例外/ logcat的? –
当我试图打开文档/ docx文件与办公套件Office套件给消息丢失
任何人都可以知道如何删除它? –