posts - 189,comments - 115,trackbacks - 0
          保存全局變量在appliation不管activty的轉(zhuǎn)換
          public
           class MyApplication extends Application { 
           
              
          private String someVariable; 
           
              
          public String getSomeVariable() { 
                  
          return someVariable; 
              
          } 
           
              
          public void setSomeVariable(String someVariable) { 
                  
          this.someVariable = someVariable; 
              
          } 
          } 
          <application android:name="MyApplication" android:icon="@drawable/icon" android:label="@string/app_name"> 
          // set 
          ((MyApplication) this.getApplication()).setSomeVariable("foo"); 
           
          // get 
          String s = ((MyApplication) this.getApplication()).getSomeVariable(); 
          posted on 2010-08-26 19:39 MEYE 閱讀(187) 評論(0)  編輯  收藏 所屬分類: Android3D
          主站蜘蛛池模板: 隆林| 抚松县| 西乌| 荆州市| 墨脱县| 贵港市| 舞阳县| 得荣县| 木兰县| 齐齐哈尔市| 丰顺县| 平湖市| 牡丹江市| 曲水县| 洪湖市| 溧水县| 于田县| 习水县| 乌拉特前旗| 蚌埠市| 潮安县| 额尔古纳市| 壤塘县| 奉贤区| 镇平县| 隆德县| 文水县| 开化县| 香格里拉县| 新平| 靖宇县| 台山市| 嘉峪关市| 青铜峡市| 昌黎县| 治多县| 万源市| 叙永县| 琼结县| 四川省| 许昌市|