在 BlackBerry 上打开 pdf、doc、ppt 或 xls

发布于 2024-10-05 14:32:48 字数 49 浏览 0 评论 0原文

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你曾走过我的故事 2024-10-12 14:32:48

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

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");
}

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");
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文