How to use an intent to open a ppt with DataViz's Documents To Go

一笑奈何 提交于 2019-12-11 00:14:28

问题


I have an Android app that among other things is able to download documents. I would like to offer the ability to open these documents with other apps like DataViz's Documents To Go viewer apps. I've looked at quite a bit of code and searched through the other questions on here and I think I'm just not doing something quite right.

For example, let's pretend I'm downloading a ppt. This bit of code is supposed to verify that the document type is supported by an app before downloading the document.

    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
    }

For some reason this bit of code doesn't register DataViz's apps or the other document viewer on my device.

And of course, if I were to call startActivity(intent); that would throw an exception.


回答1:


Try using application/vnd.ms-powerpoint as the mime type.



来源:https://stackoverflow.com/questions/6132931/how-to-use-an-intent-to-open-a-ppt-with-datavizs-documents-to-go

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!