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 Contributor
Posts: 3
Registered: ‎08-19-2010
My Device: 8300

Re: JPG doesn't load with: Bitmap img = Bitmap.getBitmapResource("img2.jpg");

This may have been obvious to everyone but a newbie like me, but I spent a lot of time trying to figure out why

Bitmap b = Bitmap.getBitmapResource("myfile.png")

always returned null.

It turns out I imported the file myfile.png to into the project folder "myproject" instead of importing it to the source folder "myproject/src".


The step-by-step:

right-click on myproject/src

click "import"

choose general, then "file system", then Next

Then browse for the file you are trying to import.


Hope it saves someone some time.

Posts: 35
Registered: ‎10-11-2008
My Device: Not Specified

Re: Unable to load image



I use net.rim.device.api.system.Bitmap


Bitmap logotipo = Bitmap.getBitmapResource("yourLogo.png");


HorizontalFieldManager logoManager = new HorizontalFieldManager(Field.FIELD_HCENTER);


logoManager.add(new BitmapField(logotipo));