3
我已经使用下载管理器下载了文件(133465.pdf),现在它存储在手机(内部存储器)的Downloads文件夹中。从内部存储的下载文件夹中打开下载的文件(pdf)
我应该如何尝试从下载文件夹中检索下载的pdf文件?
我使用下面的代码尝试从下载文件夹中检索pdf,但我在吐司上发现错误,说“无法显示PDF(133465.pdf无法打开)”。
String file = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath() + File.separator + "133465.pdf";
Log.i("Fragmentadapter1", file);
File videoFile2Play = new File(file);
Intent i = new Intent();
i.setAction(android.content.Intent.ACTION_VIEW);
i.setDataAndType(Uri.fromFile(videoFile2Play), "application/pdf");
imageContext.startActivity(i);
我不知道我是否使用正确的文件位置来访问该文件。
任何帮助或建议,将不胜感激。