【问题标题】:How to bring default pdf opener option in android studio 3.1.1如何在 android studio 3.1.1 中引入默认的 pdf 开启器选项
【发布时间】:2018-07-23 06:53:10
【问题描述】:

我制作了一个将图像转换为 pdf 的应用程序,该应用程序通过设备中的 pdf 打开器打开 pdf。我面临的问题是,如果设备中存在多个 pdf 打开器,则不会显示“记住我”选项。

是否有任何以编程方式可以启用的方法?

【问题讨论】:

    标签: java android pdf itext


    【解决方案1】:

    // 像下面这样从设备更改默认的 pdf 阅读器->

    Try clearing the defaults for the Google PDF Viewer app. You can do this on Android 4.x - 5.x by doing the following:
    
    Go to Settings -> Apps -> All.
    Scroll down to Google PDF Viewer app and tap on it.
    Scroll down to the Launch by default section and tap the "Clear Defaults" button.
    Next time you try to open a PDF, a pop-up should present you with options of all the installed apps that handle PDF viewing.
    

    //用于打开android文件

    Intent intent = new Intent(Intent.ACTION_VIEW);
    File file = new File( filename  );
    intent.setDataAndType( Uri.fromFile( file ), "application/pdf" );
    startActivity(intent);
    

    【讨论】:

      猜你喜欢
      • 2015-10-12
      • 1970-01-01
      • 2019-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多