One assembly for two different versions (4.6.4.7 and 5.0 + above) in blackberry

I want to import facebook libraries for BlackBerry 5.0 and higher and I do not want to import these libraries for 4.6 and 4.7.

I tried to use preprocessors for 4.7 and above, giving the link below: http://smartfone-more.blogspot.in/2010/05/coding-for-multiple-blackberry-devices.html

Now it works fine with JDE 4.7, but does not get the expected result for 5.0. Please find the code I tried:

//#ifdef JDE_4_7_0
import net.rim.device.api.ui.component.ButtonField;
//#else
import net.rim.device.api.ui.component.LabelField;
//#endif
import net.rim.device.api.ui.container.MainScreen;


public class TestScreen extends MainScreen{

        TestScreen(){

                //#ifdef JDE_4_7_0
                ButtonField btn = new ButtonField("Test Button");
                add(btn);
                //#else
                LabelField lbl1 = new LabelField("Test Label 1");

                add(lbl1);
                //#endif
        }
}

According to the code, I expect the result written in the else part for 5.0, and if the part for 4.7. I tested it on the device as well as on JDE.

Please, help.

+5
source share
2 answers

, JDE_4_7_0 - , BlackBerry → "" → . , .

-, ( ) :

//#preprocess

, , " " JDE_4_7_0. #else. BB eclipse , , .

EDIT:
, 5.0+, 4.x. BBant , . :

  • FacebookBlackBerrySDK-vx.x.x.jar Log4B-vx.x.x.jar(, ) 4.6. 4.5, , *. ...
  • facebook 5.0 , DeviceInfo.getSoftwareVersion DeviceInfo.getPlatformVersion.

, , 4.6+, 5.0+ fb sdk.

* . , BlackBerry BlackBerry 5.0. , , , . , 4.5, 4.5.

+3

, JDE_4_7_0_OR_HIGHER, Blackberry_App_Descriptor.xml JDE_4_7_0_OR_HIGHER "Preprocess Directives", , , JRE, 4.7 ( JRE, ). :

//#preprocess

//#ifdef JDE_4_7_0_OR_HIGHER
import net.rim.device.api.ui.component.ButtonField; 
//#else 
import net.rim.device.api.ui.component.LabelField; 
//#endif 
import net.rim.device.api.ui.container.MainScreen; 


public class TestScreen extends MainScreen{ 

        TestScreen(){ 

                //#ifdef JDE_4_7_0_OR_HIGHER
                ButtonField btn = new ButtonField("Test Button"); 
                add(btn); 
                //#else 
                LabelField lbl1 = new LabelField("Test Label 1"); 
                add(lbl1); 
                //#endif 
        } 
} 
+2

All Articles