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
Developer
Ted_Hopp
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

preprocessor and resources

I have a string resource that needs to be different across OS levels. Here are the ways I have thought to do it:

  1. maintain separate projects
  2. have multiple resource keys (HELP_TEXT_4_2, HELP_TEXT_4_7, etc.) and use the preprocessor and/or run-time logic to select the key
  3. have multiple resource files and use the preprocessor and/or run-time logic to select the resource bundle to use

None of these is very attractive. The first runs contrary to the basic strategy I've followed of using the preprocessor to maintain a single code base. The other two will mean that the .cod file for each OS version will have the resource definitions for all versions, which seems like a waste.

 

Is there any other approach?




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Developer
JCarty
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: preprocessor and resources

Good question. I'd like to know this as well. I have resources that are only necessary on certain OS builds but I'm not so familiar with ant tools so I haven't found a way to exclude them short of manually doing so.

 

That hasn't worked out so well either. I'd rather something automatic.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Ted_Hopp
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: preprocessor and resources

Yeah, it would be very nice if there was a way to use the preprocessor (or some other tool) to include or exclude compilation units based on preprocessor directives.

 

How do you exclude resources manually?




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Developer
JCarty
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: preprocessor and resources

In Eclipse, I right-click project Build Path > Configure Build Path.

 

Under Source, I set up Exclusion patterns to not compile in resources or source code based on names or just by browsing to the files I don't want in the compilation.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful