簡體   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