相关疑难解决方法(0)

以编程方式打开pdf文件进入菜单页面?

为什么每次我尝试使用以下代码在我的SDCARD中打开pdf文件时,它实际上并不打开pdf文件本身,而是进入adobe reader菜单?我的代码有什么问题吗?

Intent intent = new Intent();
    File pdfFile = new File("/sdcard/sample.pdf");
    Uri path = Uri.fromFile(pdfFile);
    intent.setAction(Intent.ACTION_VIEW); 
    intent.setData(path);
    intent.setType("application/pdf");
    intent.setPackage("com.adobe.reader");
    startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

pdf android android-intent

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

android-intent ×1

pdf ×1