慕尼黑8549860
您可以使用Singleton Pattern就像这样:package com.ramps;public class MyProperties {private static MyProperties mInstance= null;public int someValueIWantToKeep;
protected MyProperties(){}public static synchronized MyProperties getInstance() {
if(null == mInstance){
mInstance = new MyProperties();
}
return mInstance;
}}在您的应用程序中,您可以这样访问您的独生子女:MyProperties.getInstance().someValueIWantToKeep