【发布时间】:2011-11-01 09:37:38
【问题描述】:
我正在开发一个 pdf 阅读器[eBook Reader,可以显示 pdf 文件],因为 android 没有任何原生 pdf 查看器,所以我必须使用第三方 pdf 查看器。 在那种情况下,我选择了适用于 android 的 Adobe pdf 查看器。 我可以打开存储在设备 SD 卡中的 pdf 文件。 现在我想从我的应用程序中打开受密码保护的 pdf 文件。 如果用户想要手动打开受密码保护的 pdf 文件,则必须在打开时提供密码。
但我想在没有任何密码提示的情况下从我的应用程序中打开那些密码 pdf 文件。 应用程序提供密码,[应用程序知道密码]并且没有任何密码提示,pdf将打开。
目前,如果我想从我的 应用程序然后出现密码提示,需要密码才能打开它。
我正在使用此代码从 SDCARD 中存储的 pdf 文件中打开 pdf。
====
File pdfFile = new File(fileLocation);
if (pdfFile.exists())
{
Uri pdfFilepathUri = Uri.fromFile(pdfFile);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(pdfFilepathUri, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try
{
startActivity(intent);
}
catch (ActivityNotFoundException e)
{
Toast.makeText(this,"No Application Available to View PDF : "+fileLocation,Toast.LENGTH_LONG).show();
}
}
else Toast.makeText(this,"File cannot found : "+fileLocation,Toast.LENGTH_SHORT).show();
====
任何人都可以帮助我如何提供应用程序的密码, 这样它就可以自动打开pdf文件而不提示任何密码窗口。 ?
【问题讨论】:
标签: android