繁体   English   中英

如何在Android Studio 3.1.1中带来默认的PDF Opener选项

[英]How to bring default pdf opener option in android studio 3.1.1

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

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

//更改设备的默认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);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM