07-28-2008 02:37 AM
I am using JDE 4.2 to develope a BlackBerry application. I want to open a file in the default application supported by BlackBerry device.
Let me explain in depth. Whenever user selects a file to open, I want to open that file in the default application without telling the device in which application the file should be opened. In JDE 4.3 and later, this can be achieved using javax.microedition.content.Invocation and javax.microedition.content.Registry APIs. Here is the code snippet how it can be done in JDE 4.3 and later.
Invocation invocation; invocation = new Invocation("file:///store/samples/contacts/BlueDre
ss.png"); Registry _registry=Registry.getRegistry("net.rim.device.api .content.BlackBerryContentHandler"); _registry.invoke(invocation);
The above code will open the BlueDress.png file in the default application.
But this is not supported in JDE 4.2 and the earlier version.
Can anyone help me how can I achieve the same in JDE 4.2?
Solved! Go to Solution.
07-28-2008 09:15 AM
As you said, we didn't support JSR-211 Content Handler API in JDE/Handheld versions prior to v4.3.0.
For mime-types that the BlackBerry Browser can support, you can invoke the Browser with the particular URL (either to the internet or to the local filesystem). Take a look at these KB articles:
07-28-2008 09:37 AM
Thanks a lot for a quick reply. So, that's for sure now that it can't be done in 4.2
I have gone throught the links you mentioned. I have one more question regarding this:
In one of the article which you have mentioned, this is how the URL is being invoked.
BrowserSession browserSession = Browser.getDefaultSession(); browserSession.displayPage("http://www.google.com"
Now, can you please tell me what should I do if I want to invoke a local file instead of "www.google.com" here?
07-28-2008 11:11 AM
I have a few questions to help you try to troubleshoot this:
1. Which type of file are you trying to open?
2. How large is the File?
3. Can you put the same file on a web server and open it remotely by browsing to the address?
4. Do you have a network connection when you try this? (It is a know feature of some versions of the browser that it will not open a local file if it does not have signal)
5. Is there any more detail on the error in the browser? (such as a detail button or by viewing the device's event log)
07-28-2008 11:18 AM
Can you provide an exmaple URL you are using? Please note that the file connection requires 3 slashes. Example:
07-28-2008 11:24 AM
07-28-2008 11:27 AM
Yeah, you are right, file connection requires 3 slashes and I am exactly providing three slashes as you have mentioned here.
Here is my code snippet:
BrowserSession browserSession = Browser.getDefaultSession(); browserSession.displayPage("file:///store/samples/