Welcome!

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

Reply
Developer
Posts: 39
Registered: ‎07-18-2008
My Device: Not Specified
Accepted Solution

load cod image into browser.

Hi,

 

I have a content browser (rendering app) in my application. I'd like to direct the url to a file thats included in the folder /images/ that compiles with the cod. I've tried using 'file:///images/image.png' and this doesn't seem to work. How should i go about it, is it possible?

 

Cheers,

chris,

Developer
Posts: 507
Registered: ‎07-15-2008
My Device: Not Specified

Re: load cod image into browser.

[ Edited ]

****************************************************************

Folders structure

 

src-\

.......pic.gif

.......com-\

................rafael-\FileDemo.java

****************************************************************

 

 Code to open local picture file:

package com.rafael;

import java.io.*;

import net.rim.device.api.system.*;
import net.rim.blackberry.api.browser.*;



class FileDemo extends Application {


public static void main(String args[]) {

FileDemo theApp = new FileDemo();

theApp.enterEventDispatcher();

}


public FileDemo() {
BrowserSession session = Browser.getDefaultSession();
session.displayPage("cod://test/pic.gif" );
}
}

 

If I place pic.gif into an additional nested folder - the code won't work, even I specify this nested folder in url. File has to be located at the root of your package folders structure.

 

Note that the file location is composed via rule:

 

cod://CodModuleName/fileName.ext

 

This sample code compiled into test.cod file. And because of that there is "test" word specified into the file location.

Message Edited by rafo on 09-08-2008 12:21 PM
----------------
if your issue solved set "Solution" mark at the relevant post
Highlighted
Developer
Posts: 39
Registered: ‎07-18-2008
My Device: Not Specified

Re: load cod image into browser.

This worked perfectly, thank you.