How to open Doc or Pdf extension file inside app

1.5k views Asked by At

I am working on a app where there is need to open (.xls/.xlsx/.doc/.docx/.pdf) extension inside the app . Please tell me is this feasible? . How we can open these all indie app?

2

There are 2 answers

0
Paritosh On BEST ANSWER

For PDF files, try MuPDF library. Check licence agreement before you start. Also check

To open doc file, there are multiple approaches. Check bellow links

1
Nargis On

You can use this method to open a file that is present in SDCard

/* 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();
        }
    }