How can I create global variable keep remain values around the life cycle of the application regardless which activity running.
You can use a Singleton Pattern
like this:
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;
}
}
In your application you can access your singleton in this way:
MyProperties.getInstance().someValueIWantToKeep