2

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

blue-sky
  • 51,962
  • 152
  • 427
  • 752

5 Answers5

2

Try Bitmap.getBitmapResource("bg_general.png")

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

asdf
  • 21
  • 1
2

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

John Conde
  • 217,595
  • 99
  • 455
  • 496
1

You might want to check "Bitmap.getBitmapResource - How to navigate through a folder hierarchy to refer to a PNG file."

Scott W
  • 9,742
  • 2
  • 38
  • 53
1
Bitmap.getBitmapResource("images/bg_general.png");

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

Brian Deragon
  • 2,929
  • 24
  • 44
Chin
  • 11
  • 1
0

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");

LeRoy
  • 4,189
  • 2
  • 35
  • 46