You can not. All you can do is hide the intention and let the system handle it. If the user already has the default application that they have selected for processing PDF files, this is the one that will open the PDF file.
In general, this is something like:
File file = new File("/sdcard/example.pdf"); if (file.exists()) { Uri path = Uri.fromFile(file); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(path, "application/pdf"); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); try { startActivity(intent); } .......
source share