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 閱讀(190) 評論(0)  編輯  收藏 所屬分類: Android3D
          主站蜘蛛池模板: 连山| 福安市| 平昌县| 牙克石市| 孝感市| 英超| 海林市| 天气| 汉川市| 株洲市| 中阳县| 潮州市| 桂平市| 砚山县| 双流县| 三都| 镇远县| 晋宁县| 中牟县| 定南县| 友谊县| 泸水县| 阿克陶县| 鹤壁市| 黄骅市| 瑞昌市| 永宁县| 海口市| 迁安市| 邓州市| 略阳县| 应用必备| 龙川县| 平遥县| 萍乡市| 修武县| 海阳市| 慈利县| 江永县| 娄底市| 玉环县|