BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-22-2008, 11:35 PM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: at&t
Posts: 40
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question Eclipse and bitmap resources

Please Login to Remove!

New to Eclipse, using Ganymede.

Have it all setup with a nice Ant build script, and everything seems fine but when I run the program (which worked fine under the BB JDE), it runs into a Null Pointer exception because it can't find the bitmap resources.

My directory structure is this:

Code:
workspace
+
+--com_crackberry_launcher
     +
     +--bin
     +--dist
     +--src
         +
         +--com
              +
              +--crackberry
                   +
                   +--img   (.png files here)
and the relevent code is:

Code:
    public static void setColor(String color) {
        icon1 = Bitmap.getBitmapResource(color + "A.png");
        icon2 = Bitmap.getBitmapResource(color + "B.png");
        HomeScreen.updateIcon(icon1, 1);
        HomeScreen.setRolloverIcon(icon2, 1);
    }
and part of the build.xml:

Code:
	<target name="Build" description="builds application" depends="-Init">
		<rapc output="${output}" destdir="${dist}" jdehome="${jdehome}" jdkhome="${javahome}">
			<jdp type="cldc" 
				title="${title}" vendor="${vendor}" 
				version="${version}" 
				description="${description}" 
				systemmodule="true" 
				runonstartup="true" 
				startuptier="7" >
				<entry 
					title="${title}" 
					arguments="click" 
					systemmodule="false" 
					runonstartup="false" 
					startuptier="7" 
					ribbonposition="0" 
					icon="OrangeA.png" />
			</jdp>
			<src>
				<fileset dir="${src}">
					<include name="**/*.java" />
					<include name="*.png" />
					<include name="resources/**/*.*" />
				</fileset>
			</src>
		</rapc>
		<copy todir="${simulator}" verbose="false">
			<fileset dir="${dist}">
				<include name="*.cod" />
				<include name="*.debug" />
				<include name="*.cso" />
			</fileset>
		</copy>
		<echo message="Build ${build.number} complete." />
	</target>
What am I doing wrong?

Also, when I right click and build, using Ant, I have to manually start the simulator by clicking "Launch Simulator" on the sim server. Is there a way to have it auto-launch?

Thanks
Offline  
Old 07-22-2008, 11:49 PM   #2 (permalink)
New Member
 
Join Date: Jul 2008
Model: 8100
PIN: N/A
Carrier: 8-)
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

try <include name="**/*.png" /> or <include name="com/crackberry/*.png" />
Offline  
Old 07-23-2008, 12:15 AM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: at&t
Posts: 40
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, that did the trick!
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.