BlackBerry - how to pass data like Intent.putExtra() in Android

后端 未结 3 1556
甜味超标
甜味超标 2021-01-24 16:07

I am newbie on BlackBerry. How do I achieve (in BlackBerry) the same as that of Android\'s

intent.putExtra(\"key\",\         


        
3条回答
  •  时光说笑
    2021-01-24 16:43

    create one public class,

    public class Values 
    {
        public static String value1 ="";
        public static String value2 ="";
    }
    

    Now u can access the value1,and value2 in anywhere.

    before push the next screen, assign the values.

    public class MyClass extends UiApplication 
    {
    
    
        MyClass mc = null;
        public static void main(String args[]) 
        {
            mc = new MyClass();
            if (MyClass != null)
            {
                mc.enterEventDispatcher();
            }
        }
    
        public MyClass() 
        {
                   Values.value1 ="HI"
                   Values.value2 ="Welcome"
        this.pushScreen(new SplashScreen());
        }
    

    In another class u can access it.

    public class Splashscreen()
    {
       public Splasscreen()
    {
           if(!Values.Value1.equalIgnoreCase("")
    {
               Syso(""+Values.value1)   ;
    }
    }
    

提交回复
热议问题