我如何在 Android 中读取 SD 卡中的文件 PDF?

How I read file PDF in SD card in Android?

我的 SD 卡上保存了一个 .PDF 文件。我需要读取 .PDF 文件的内容并将其显示在 TextView 中。

我该怎么做?

例如,您可以使用类似的东西 - 获取文件路径并将其作为新意图打开:

// get the file path from the external storage (SD card)
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/yourPdfName.pdf");
Intent intent = new Intent(Intent.ACTION_VIEW);
// set the content type and data of the intent
intent.setDataAndType(Uri.fromFile(file), "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
// start the intent as a new activity
startActivity(intent);