Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 5
Registered: ‎07-23-2009
My Device: Not Specified

Blackberry 4.3 - Issue with the Resource class

Hi ,

 

I just downloaded a sample code for Storing persistent data and tried to compile it for Blackberry Curve (OS 4.3). 

 

There is a statement that uses following function of the Resource class

Resource.getResourceClass()

 

I get the error that Method not available. Now if I go to the Java DOC then I dont find java doc for the Resource class. Please let me know how should I use it for 4.3

 

Regards,

Anant

Developer
Posts: 17
Registered: ‎08-05-2009
My Device: Not Specified

Re: Blackberry 4.3 - Issue with the Resource class

Hi Anant,

 

I too was having troubles with the Storing Persistent Data (4-Storing Peristent Data) code sample as well as other code samples from 

http://na.blackberry.com/eng/developers/resources/developer_labs.jsp#tab_tab_jde

such as 3-Localization.  

 

Here's my environment:

 

Eclipse 3.4.2 with BlackBerry JDE Plug-in

Using BlackBerry Smartphone Simulator

 

Copied the *.java files from the 'complete' sample code zip files (keeping the folder structure in the example).  NOTE: I did not copy the resource files (.rrh and .rrc) nor the .jdp, jdw or .bin files.  The resource files were then missing when I went to run in the simulator of course.

Our main problem here may be that we did not start from the 'incomplete'  sample code or that we need to create the .rrh and .rrc files using the tool from BlackBerry in Eclipse (New -> Other -> BlackBerry -> BlackBerry Resource File).  Or our problem may be that we did not start with teh .jdw file and created our own Eclipse project instead (but you don't have to if you follow my instructions below)?

 

Here are the problems I encountered:

Eclipse marks the reference to Resources.getResourceClass() as not available in e.g. BCityInfoB£.java. 

 

Solution:

Just delete this file - I believe it is not needed in Eclipse (not sure if it is needed in the BlackBerry JDE since I don't use that - someone else might be able to comment on this).

 

Extra Info to Solution:

Once I deleted the file CityInfoB£.java and rebuilt the project I tried to run on the simulator and it gave the error - cannot find resource file.

I then aded the resource files (putting them in the package with the main class) which then gave an error upon building that the class CityInfoBResource was duplicated.  Apparently this is because the class CityInfoBResource is just a construct for Eclipse and is not needed to be part of the resulting JAR file.  Thus, you can either hide this file from the builder or just delete it (it will be added in the .tmp folder (if you noticed the error it was duplicating this class only in the .tmp folder so Eclipse is creating this class for you?).

 

To hide a file from the builder do as follows:

Right click your project and choose  Build Path -> Configure Build Path

Select the Java Build Path in the left side menu (it may already be selected)

Select the Source tab in the main window

Double click on the src package folder (or the package folder where the files/folders you want to exclude from the build are located)

Click on Next

You should see to sections titled 'Inclusion patterns:' and 'Exclusion patterns:'.  We want to exclude so click on the Add Multiple... button in the 'Exclusion patterns:' section.  Click down the file structure to the file you want to exclude (or folder) and then click OK.

You should see your file/folder now listed in the 'Exclusion patterns:' display box.  Now click Finish.

 

References:

I got some help on this from another thread as follows (at least for the need to exclude the CityInfoResource.java file):

Steps for Localizing BlackBerry Apps