标签:
1 继承application
public class CustomApplication extends Application
{
private static final String VALUE = "Harvey";
private String value;
@Override
public void onCreate()
{
super.onCreate();
setValue(VALUE); // 初始化全局变量
}
public void setValue(String value)
{
this.value = value;
}
public String getValue()
{
return value;
}
}
2.在ApplicationManifest.xml文件中配置自定义的Application
<application android:name="CustomApplication"> </application>
标签:
原文地址:http://www.cnblogs.com/wj519752831/p/4996820.html