本文介绍了在BlackBerry上打开pdf,doc,ppt或xls的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在BlackBerry上以编程方式打开pdf,doc,ppt或xls?

How do I open pdf, doc, ppt or xls programmatically on a BlackBerry?

推荐答案

最好的方法是购买第三方查看器并启动该查看器以查看文档:

The best approach is to purchase a 3rd-party viewer and launch that to view the document:

String path = "file://SDCard/info.doc";
String contentType = MIMETypeAssociations.getMIMEType(path);
Invocation invocation = new Invocation(path, contentType, null, false, ContentHandler.ACTION_OPEN);
Registry registry = Registry.getRegistry(MyApp.class.getName());
try {
    ContentHandler[] handlers = registry.findHandler(invocation);
    if (handlers != null && handlers.length > 0) {
       invocation.setID(handlers[0].getID());
       registry.invoke(invocation);
    } else {
       Dialog.alert("Error");
    }
} catch (Exception e) {
    Dialog.alert("Error");
}

这篇关于在BlackBerry上打开pdf,doc,ppt或xls的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 18:11