android 打开PDF

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);
                        } catch (ActivityNotFoundException e) {
                                Toast.makeText(this,
                                                "No Application Available to View PDF",
                                                Toast.LENGTH_SHORT).show();
                        }


你可能感兴趣的:(android 打开PDF)