Subfolder in res folder not finding image

1.3k Views Asked by At

I'm attempting to load a bitmap image from an images folder from within the res folder using - Bitmap.getBitmapResource("/images/bg_general.png")

But the image is not being found even though it exists at specified path. Im using blackberry eclipse plugin. Here is a snippet of my dir structure where the image is located -

enter image description here

5

There are 5 best solutions below

0
On BEST ANSWER

Bitmap.getBitmapResource("bg_general.png") is the correct way to display the images. It works for me. Also, check whether the image is empty.

0
On

Try Bitmap.getBitmapResource("bg_general.png")

I think the file system is basically flattened in the cod file.

0
On
0
On
Bitmap.getBitmapResource("images/bg_general.png");

remove the first /, the getBitmapResource function works with the res-folder as baseURL.

0
On

It looks like it Searches for the file name automatically.... logically/makes sence to me it would be:

Bitmap logo = Bitmap.getBitmapResource("src/001.png");

or

Bitmap logo = Bitmap.getBitmapResource("res/001.png");

but just saying "001.png" is enough

Bitmap logo = Bitmap.getBitmapResource("001.png");