在android中使用Intent拾取PDF文件
嘿,我是android新手,我需要使用在android中使用Intent拾取PDF文件,android,android-intent,Android,Android Intent,嘿,我是android新手,我需要使用Intent选择pdf文件。我正在使用此代码设置MIME的类型 Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("pdf/*") 但是它没有按照我想要的方式工作,请提供任何建议,或者我可以对现有代码进行一些更改 这样做intent.setType(“application/pdf”)请尝试以下代码: Intent intent = new Intent(Intent
Intent
选择pdf
文件。我正在使用此代码设置MIME的类型
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("pdf/*")
但是它没有按照我想要的方式工作,请提供任何建议,或者我可以对现有代码进行一些更改 这样做
intent.setType(“application/pdf”)代码>请尝试以下代码:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setType("application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
如何通过intent仅打开word文件??只需设置word文件的mime类型,例如.docx文件mime类型将为:application/vnd.openxmlformats-officedocument.wordprocessingml.document so intent.setType(“application/vnd.openxmlformats-officedocument.wordprocessingml.document”);这里给出了Microsoft Office MIME类型。我的系统的文件选择器将Google Drive显示为提供程序。如果单击“驱动器”,我可以选择一个非PDF文件。除了通过仅使用额外的本地驱动器来完全消除驱动器之外,如何解决这个问题?