2010-12-02 110 views
1

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

+0

我想通过编程来读取PDF文档。其实我们可以在iPhone中使用webview来阅读文档。我的问题是,有没有选择或控制黑莓阅读PDF文档?提前致谢。 – Finder 2010-12-03 04:52:28

回答

4

最好的办法是购买一个第三方浏览器和发射,要查看该文件:

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"); 
} 
相关问题