Using Preprocessor Directives to Port Java ME Applications
Sunday, April 1st, 2007There may be times when you want to take advantage of device-specific features, yet support as wide a selection of devices as possible. For example, perhaps you want to play sound in your application, but you also want to target several different platforms, each with different APIs for playing sounds. You could manually create a new project for each device you wish to support, but that could quickly turn into a nightmare as you try to keep common code in sync. That’s where preprocessor directives come in. This handy feature allows you to insert conditional logic into your source files that will include or exclude blocks of code before it gets to the Java compiler.
Wireless Edition