Blackberry Java Technology

Open a doc file saved in SD Card Blackberry 8900 (Java)

To open a doc file saved in SD Card in Blackberry 8900, the WordToGo Application can be used. To do the same functionality within your application, you need to use the following Lines of Code.
BrowserSession brSession = Browser.getDefaultSession();
brSession.displayPage("file:///SDCard/documents/hello.doc");

When you run the above lines of code, the doc file will open inside the WordToGo application.


An example is given below using the ApplicationManager:-

ApplicationManager manager = ApplicationManager.getApplicationManager();
int modHandle = CodeModuleManager.getModuleHandle("WordToGo");


ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors(modHan dle); ApplicationDescriptor descriptor = apDes[0];
String[] args = {"file:///SDCard/documents/hello.doc"};

ApplicationDescriptor newDescriptor = new ApplicationDescriptor(descriptor, descriptor.getName(), args);
try {
manager.runApplication(newDescriptor);
} catch (ApplicationManagerException ex) {
System.out.println("Exception: " + ex.toString());
}

catch(Exception ex){
System.out.println("Exception: " + ex.toString());
}

When you execute the above lines of code, the doc file will not be opened and it will throw a DocsToGoException.

Spread the love
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments