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?
How to open Doc or Pdf extension file inside app
1.5k views Asked by Conrad Media At
2
There are 2 answers
1
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();
}
}
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