-1
如何从原始文件夹打开PDF文件? 这种访问代码的PDF文件从SD卡文件..从原始文件夹打开PDF文件?
File file = new File(getFilesDir(), "teen_ebook.pdf");
try {
if (file.exists()) {
Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Log.e("IR", "No exception");
}
else {
Toast.makeText(PdfActivity.this, "File NotFound",Toast.LENGTH_SHORT).show();
}
}
catch (ActivityNotFoundException e) {
Toast.makeText(PdfActivity.this, "No Application Available to View PDF", Toast.LENGTH_SHORT).show();
}
但我想访问的PDF文件从原文件夹? 任何一个在这里。请给我建议。
的(http://stackoverflow.com/questions/19865276/best-way-to-include-pdfs-in-an-app) – CommonsWare
[以包括在应用中的PDF文件的最佳方式]可能重复请告诉我以其他方式访问PDF文件。 –