0

I am using this code -

HorizontalFieldManager hfm = new HorizontalFieldManager();
    this.add(hfm);
Bitmap HELLO_LOGO = Bitmap.getBitmapResource("test.jpg");
BitmapField helloBmpField = new BitmapField(HELLO_LOGO);
hfm.add(helloBmpField);

I have 3 files in the img folder under res - test.jpg,icon.png,tester.gif I also have a labelfield in the horizontal manager. Either of them show now but not both. I have checked the size of the image that is fine too. I have tried all 3 files one by one - it takes up some space on the screen but the image doesn't show up with any of the 3 files

Can someone please tell me what am I doing wrong Thanks

Jatin
  • 1,668
  • 2
  • 16
  • 23
  • I've used the same code you posted above, just changed the image name `"test.jpg"` to an image in the `res/img/test.jpg` of my project folder, and added the code in the constructor of my `MainScreen`... it's working fine On 9700 (OS_5), 9800 (OS_6) and 9300 (OS_7) simulators. Don't understand why you are facing problem... Provide us with some more code... at least your whole `MainScreen` where you've added the above code. – Tariq M Nasim May 05 '12 at 04:13

2 Answers2

0

You could add some debug output statements to this code, and check if the image is loaded.

Missing some context, I assume this code is taken from the constructor of a Screen class. If not, this could be a problem with the event-handling thread.

First check: is the filename comlete? should it be "img/test.jpg" instead of "test.jpg"?

G B
  • 2,951
  • 2
  • 28
  • 50
0

Check the extension of the name of the image you have put in your res folder. May be the image is named as test.JPG (capital letter for extension) in the res folder but in your code you've written test.jpg (small letter for extension) or any other naming mistake like this...

Tariq M Nasim
  • 1,278
  • 11
  • 24