【发布时间】:2012-04-25 09:01:41
【问题描述】:
在我的应用程序中,我正在内部应用程序文件(数据/数据/包/文件)中创建一个 pdf 文件,我希望这些文件在我使用以下代码读取它们时是可读的:
Uri path = Uri.fromFile(pdfFile);
Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
pdfIntent.setDataAndType(path, "application/pdf");
pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
我已阅读有关使用 openOutputStream() 方法的信息,但我不知道如何通过此阅读它们。有人可以帮我吗?
编辑
pdf文件--
File directory=getFilesDir();
pdfFile=new File(directory,filename+".pdf");
【问题讨论】:
-
你的
pdfFile字符串包含什么? -
@Pallavi - 文件目录=getFilesDir(); pdfFile=new File(目录,文件名+".pdf");
-
what does your pdfFile string contain?表示值,当您将其写入 LogCat 或其他地方时...pdfFile=/mnt/data/...pdfFile 变量的值是什么?