如何在应用程序内打开文档或PDF扩展名文件



我正在开发一个需要在应用程序内打开(.xls/.xlsx/.doc/.docx/.pdf)扩展的应用程序。请告诉我这可行吗?.我们如何打开这些所有独立应用程序?

对于 PDF 文件,请尝试 MuPDF 库。在开始之前检查许可协议。还要检查

  • Android PDFView
  • APV 库

要打开文档文件,有多种方法。检查波纹管链接

  • 阿帕奇 POI
  • 谷歌文档查看器

您可以使用此方法打开 SD 中存在的文件

/* Browses the SD Card using Intent Action Get Content */
    private void browseFileFromSDCard() {
        TLog.i(LOG, "Browse File From SD Card");
        Intent selectFile;
        Intent intent;
        selectFile = new Intent(Intent.ACTION_GET_CONTENT);
        selectFile.setType("file/*");
        intent = Intent.createChooser(selectFile, "Select a file");
        try {
            startActivityForResult(intent, SELECT_FILE);
        } catch (ActivityNotFoundException ex) {
            TLog.w(LOG, "Activity Not found Exception");
            String fileManagerNotFoundMessage = getResources().getString(R.string.file_manger_not_found_message);
            Toast.makeText(this, fileManagerNotFoundMessage, Toast.LENGTH_SHORT).show();
        }
    }

最新更新