Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
你可以帮帮我吗?我想在进入特定活动(假设测试设备)时检查是否有任何应用程序可以读取 pdf,如果没有,则显示一个 toast 说该应用程序未安装,我需要使用 mime“应用程序/pdf”对吗?感谢您的帮助!抱歉英语不好
Intent步骤#1:为您希望执行的操作创建一个(例如,为特定ACTION_VIEW的 MIME 类型)application/pdfUri
Intent
ACTION_VIEW
application/pdf
Uri
步骤#2:使用PackageManager和queryIntentActivities()或resolveActivity()找出可以处理此请求的已安装内容。
PackageManager
queryIntentActivities()
resolveActivity()