Reputation: 1708
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
Upvotes: 0
Views: 144
Reputation: 1278
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...
Upvotes: 0
Reputation: 3024
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"?
Upvotes: 0