android - 如何使用 Intent 打开带有 DataViz 的 Documents To Go 的 ppt

标签 android android-intent powerpoint

我有一个 Android 应用程序,除其他外,它还可以下载文档。我想提供使用其他应用程序打开这些文档的功能,例如 DataViz 的 Documents To Go 查看器应用程序。我查看了相当多的代码并搜索了此处的其他问题,但我认为我做的事情并不正确。

例如,假设我正在下载一个 ppt。这段代码应该在下载文档之前验证应用程序是否支持该文档类型。

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setType("application/ppt");

    PackageManager packageManager = getPackageManager();
    List intentList = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
    if (intentList.size() == 0) {
      // error
    }

出于某种原因,这段代码没有在我的设备上注册 DataViz 的应用程序或其他文档查看器。

当然,如果我要调用 startActivity(intent);那会引发异常。

最佳答案

尝试使用 application/vnd.ms-powerpoint 作为 mime 类型。

关于android - 如何使用 Intent 打开带有 DataViz 的 Documents To Go 的 ppt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6132931/

相关文章:

android -> 无法在 :/opt/android-sdk-linux 中找到哈希字符串 'android-26' 的目标

android - 在 Listview onItemClick() 监听器不工作?

android - 使用默认资源管理器查看 Android 中的文件夹内容

python - python-pptx 中的颜色图表

python - 用于语法突出显示的 powerpoint/openoffice 插件

android - ML Kit - Android - 文本识别 - 文本方向

android - 什么是 ConstraintLayout 优化器?

Android 选择电子邮件 Intent

android - FLAG_ACTIVITY_CLEAR_TOP 和 onActivityResult

vba - PPT 的宏 - 将文本框内容移动到占位符 - 维护链接和列表