开发者

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

开发者 https://www.devze.com 2023-03-08 05:52 出处:网络
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

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 = packageManage开发者_开发知识库r.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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消