- 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
最新推荐文章于 2024-09-21 10:48:37 发布