Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

New Developer
Posts: 39
Registered: ‎11-18-2008
My Device: Not Specified

Opening files on the BlackBerry

Hi all,

I am developing a third party application on Windows that stores a file's mime type and mime data in a database. I am building a client for it on the BlackBerry and trying to handle viewing these files on the BlackBerry. There is no actual file that is ever saved on the server....when a user adds/attaches a file in my app, the filename and the data are persisted on the server in a table. When the user wishes to open an attachment on the client, a request is made to the server to read the mime data from the database. Therefore the client is only ever given the mime type and the mime data and needs to open it on the BlackBerry with the appropriate application. On our desktop client in Windows, we create a file with the given mime type and data and then open it in the default Windows app. Can something similar be done on the BlackBerry. Is there a way to programmatically create a temp file on the fly and open it with the default application configured for the given mime type on the BlackBerry?


I have read up on the BlackBerryContentHandler in 4.3 and from what I understand a file can be opened by passing to the Invocation constructor the location (on the internet or local filestore) where a certain file exists. Would this solution work if there is a way for me to construct a file on the BlackBerry filesystem given the mime type and data from the server.

What about devices that don't have the BlackBerryContentHandler (version 4.2 and lower)? Does anyone know of a solution that would work in this case?


The only other thing I can think of is to have the server email the file to the BlackBerry user's inbox and get them to view it from there.  


Thanks in advance,


BlackBerry Development Advisor
Posts: 15,806
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Opening files on the BlackBerry

[ Edited ]

This can be done using the JSR 211 Content Handler APIs.  Please have a look at the chapidemo that is included with the BlackBerry JDE for an example.


There are no alternative APIs to provide this same functionality in previous BlackBerry handheld software versions.


You could send you files as attachments assuming they are file types supported by the BlackBerry attachment service.

Message Edited by MSohm on 12-08-2008 01:28 PM
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.