Wednesday, November 11, 2015

How to open PDF document in Android

public void openpdf() {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/PDF";

        File file = new File(path, "guest.pdf");

        intent.setDataAndType(Uri.fromFile(file), "application/pdf");
        startActivity(intent);
    }

No comments:

Post a Comment