How can I create global variable keep remain values around the life cycle of the application regardless which activity running.
Easy!!!!
Those variable you wanna access as global variable, you can declare them as static variables. And now, you can access those variables by using
classname.variablename;
public class MyProperties {
private static MyProperties mInstance= null;
static int someValueIWantToKeep;
protected MyProperties(){}
public static synchronized MyProperties getInstance(){
if(null == mInstance){
mInstance = new MyProperties();
}
return mInstance;
}
}
MyProperites.someValueIWantToKeep;
Thats It! ;)