You Are Here:

Community: Wiki

This page was last modified on 8 June 2009, at 06:25.

How to use preprocessor symbols?

From Forum Nokia Wiki

If you are using an IDE like eclipse or NetBeans & also you want to make a same source for two different phones then you may make use of pre-processing symbols.

For example you have two phones, one a Nokia MIDP 1.0 phone having fullcanvas & other phone is a MIDP 2.0 phone. So in the first phone the source should have Fullcanvas & in the other, just Canvas. For this use the following code

//#ifdef Nokia
 
public class Main extends FullCanvas {
 
//#else
 
public class Main extends Canvas {
 
//#endif

This is also useful in cases where a same source is used for different resolution phones. eg:

//#ifdef NOKIA_NGAGE
 
width= 176;
 
height=204;
 
//#elseif NOKIA_3100
 
width = 128;
 
height = 128;
 
//#elseif NOKIA_6300
 
width = 240;
 
height = 320;
 
//#endif

This preprocessing symbol has a major use in the porting industry.

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia