【发布时间】:2014-09-03 15:30:43
【问题描述】:
我需要打开一个 PDF。我知道程序,这是我的代码:
string file_path = _path + url.Substring (5);
if (System.IO.File.Exists(file_path)) {
Android.Net.Uri pdfFile = Android.Net.Uri.FromFile (new Java.IO.File (file_path));
Intent pdfIntent = new Intent (Intent.ActionView);
pdfIntent.SetDataAndType (pdfFile, "application/pdf");
pdfIntent.SetFlags (ActivityFlags.NoHistory);
_parent.StartActivity (pdfIntent);
return true;
}
我正在使用 Xamarin,并且路径存在,因为我检查了它,如您所见。 该应用程序会打开 Adobe 阅读器,但在启动时会显示一条错误消息(未找到文件)。所以,我的文件在
/data/data/com.myapp/files/.hide/contents/file_test.pdf
有设置权限吗?我真的不明白为什么它无法打开我的文件!
【问题讨论】:
标签: android pdf android-intent xamarin