08-29-2011 01:10 AM - edited 08-29-2011 12:48 PM
I have a trouble with an image resource and I think is so easy to fix but I just cant get the answer so far.
I'm trying to load an image using Bitmap.getBitmapResource("logo.png"). The problem is that is not working. I have checked the .jar file and the images are not there so obviously that is the matter. I just don't know how to make the eclipse to load the files into the jar file.
Just for the record:
* The files are directly in src folder.
* I have tried all the path combinations
* I have deleted and re-imported the images
* i have changed the SDK from 4.6.0 to 4.6.1
* I have recreated the project.
Nothing works!!!! . the .JAR file doesnt have the images inside,
A situation I just discovered is that if I use JRE 5.0, the same code, the same directory structure, it works fine. So the problem is with JRE 4.6 and 4.6.1. Somebody with the same problem?
08-29-2011 02:13 AM - edited 08-29-2011 02:14 AM
create new folder "res" if it's not there along with src folder & move your all images to this folder.
check the property of project:
check in your code that "/" (slash) is added before your image name in create Image method eg
08-29-2011 11:10 AM
Thanks to both of you, I tried both solutions, nothing works.
It is strange cause the only image that actually is inside the jar file is the app icon, so if I use
Bitmap imgHeader = Bitmap.getBitmapResource("/icon.png"); instead of logo.png it works.
Any other advice?
08-29-2011 11:11 AM
03-20-2012 04:01 PM
I have a solution that perharps is not too good but here we go. I had the same problem doing this from eclipse so i replace the file rapc.exe and rapc.jar in C:\Program Files (x86)\Research In Motion\BlackBerry JDE 4.6.1\bin with the files in my eclipse component 5.0 in my case C:\EclipseBlackberryJava\plugins\net.rim.ejde
So simply do this rename rapc.exe and rapc.jar from JDE 4.6.1 to rapc.exe.old and rapx.jar.old just in case don't work and copy rapc.exe and rapc.jar from net.rim.ejde.componentpack5.0.0_220.127.116.11\component
Let me know if someone else got this work like that too.