全局变量
创建一个继承于Application类的全局类
public class MyGlobal extends Application {
public int testnumber = 1;
@Override
public void onCreate() {
super.onCreate();
}
}
配置中要加:
android:name=".MyGlobal"
在Activity中:
private MyGlobal myApp;
myApp = (MyGlobal)getApplication();