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
weaselgrater
Posts: 87
Registered: ‎08-25-2009
My Device: Not Specified

Managing Multiple OS: Best Practices?

There is one feature of the application that is only possible in devices with at least Blackberry API level 5.0. The entire class (extends MainScreen) is underlined red when using another JRE. Can anyone give me some examples of how they handle these classes? Would you put an if at the beginning and end of the classfile?

 

 

//#preprocess
//#ifdef BlackBerrySDK5.0.0
package bb.myapp.ui.screens;

import java.util.Vector;
import net.rim.device.api.system.Bitmap;
.....

public class ViewPhotosScreen extends MainScreen{
....
}

...

public static int foo(){}

} //#endif

(I tried the above and I could not get the icon in the package explorer to stop reporting an error)

 

 

And where the class is imported, and instantiated?

 

 

Any best practices in general for different cases for clean code would be greatly appreciated.

 

Thanks!

 

 

 

Please use plain text.
Developer
Developer
CMY
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Managing Multiple OS: Best Practices?

Only put the ifdef around the 5.0 specific code (functions.imports,etc) and leave the rest outside.

Please use plain text.