How to use an intent to open a ppt with DataViz's Documents To Go
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.
精彩评论