05-29-2012 09:41 AM
Hi,
I'm trying to put the reprocessor Directives code in my app project. The first problem that I'm facing is
that I can't follow up with the steps that this link is providing. I'm not sure but I think that the information
is kind of dated, because I'm not able to find Blackberry Project Properties under properties.
http://berrytutorials.blogspot.com/2009/11/coding-
Waiting for your help.
Thanks.
05-29-2012 09:52 AM
05-29-2012 10:13 AM
Thanks Simon,
You are always here with your great responses. Yes, I know the site is kind of old
.
Is there like a link with more information about that?
Thank you again.
05-29-2012 10:25 AM
05-31-2012 09:06 AM
Thank you so much again Simon. Actually, I tried the code that the blackberry website providing, it didn't work. I'm not sure I did it in the right way. They didn't explain it in a good way. Did you work with the Reprocesses Directives (RD) before? I will explain to you what I understood and then it would be great if you can correct my understanding.
I wrote an app and compile it with JRE 7, which is normally won't work with JRE 6 or 5. But if we use the (RD) that would make the eclipse skip the lines of code that is not supported by JRE 6,5 and compile it normally.
My questions are :
1- when we compile it with 7 are we going to use the same Lax file with BB devices that runs JRE 5,6... Or vise versa, I mean we compile it with 5,6 and use the same Lax file with 7.
2- As the BB site saying that we should
/#processes in the first line of the code.
/# implicit ( This was from another website)
//# of def tag ... # else
end if...
to surround the code that is not supported by the older JRE.
Is that right? I did it and when I put this on eclips it make it like a comment, and it won't let it compile.
I'm kind of confused... I hope that anyone can explain more about that. And it would be great if there would be a code to support that.
Thank you so much.
05-31-2012 09:28 AM
//#ifdef VER_4_6_0_AND_ABOVE private MessageFolderDaemon messageFolderDaemon; //#endif
In the BlackBerry_App_Descriptor.xml on the Build tab you create the directive VER_4_6_0_AND_ABOVE using the add button. When you switch to 4.6 or higher you enable it by clicking the active checkbox. you can use similar conditions for 4.7, 5.0, 6.0 etc I think '#else' is problemativ, we avoid it at least, but '#ifndef' should work. sometimes i use boolean flags for more complicated constructs05-31-2012 10:51 AM
Thank you Simon.
I went tothe Descriptor.xml --> Build and I found that BLACKBERRYSDK5.0.0
Are all here, but only Blackberry7.0.0 is checked. And it won't let me check the rest.
So, I first turn the preprosser
You can turn on preprocessing for your applications by updating the Eclipse® configuration file.
1. Browse to C:\Program Files\Eclipse\configuration, open the config.ini file.
2. Add the following line to the config.ini file:
• osgi.framework.extensions=net.rim.ejde
and then put the code
'//#preprocess'
//#ifdef VER_4_6_0_AND_ABOVE
.........
//#endif
the other SDK would be available for me to check? or I should install other things?
Okay, Let's say I clicked SDK5. That means I will have one file for JRE 5 and another one by clicking the SDK6 for 6. Or 5 file will work with all the versions.
Sorry for asking a lot.
I really appreciate your help Simon.
05-31-2012 10:59 AM
05-31-2012 11:46 AM
I get by with the pre-defined defines just fine using #ifdef #elseif and #endif e.g.
//#ifdef BlackBerrySDK4.6.0 | BlackBerrySDK4.6.1 HomeScreen.updateIcon(TaskingResourceManager.getBitmapFromResource("tasking_icon_64.png")); HomeScreen.setRolloverIcon(TaskingResourceManager. getBitmapFromResource("tasking_icon_64_ro.png")); //#elseif BlackBerrySDK4.7.0 | BlackBerrySDK5.0.0 | BlackBerrySDK6.0.0 | BlackBerrySDK7.0.0 | BlackBerrySDK7.1.0 ApplicationDescriptor ad = ApplicationDescriptor.currentApplicationDescriptor (); HomeScreen.updateIcon(TaskingResourceManager.getBi tmapFromResource("tasking_icon_64.png"), ad); HomeScreen.setRolloverIcon(null, ad); //#endif
maybe a bit long winded, but in place it tells the full story without referring to custom defines
05-31-2012 11:47 AM
So, should I change the the build path on my project and let see JRE 5 and JRE6? Because when I do that right now. It gives me an error. And it flag the project with red and showing me an error in line zero. I can't see what is going wrong on the Java files cause it shows no wrong with them. The only thing is red is the project folder and the project won't run on the simulator.