How to read a pdf in android

u can download PDFbox API to read PDF in android try this link: http://pdfbox.apache.org/


You need to have a application which can support that mimetype and open it. In your device/emulator that app is not installed so it is throwing error


Another great solution to read pdf using externally installed application like Adobe Reader.

private void openPDF(final String pathToPDF) {
    File file = new File(pathToPDF);
    Uri path = Uri.fromFile(file);
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.setDataAndType(path, "application/pdf");
    try {
        startActivity(intent);
    } catch (ActivityNotFoundException e) {
        Toast.makeText(this, "Application not found", Toast.LENGTH_SHORT).show();
    }
}