How can I write singleton to work through several processes? Is it possible? For example I have code that works with Remote Service in Android. How can I write singleton for this purpose?
UPDATE:
public enum Singleton {
INSTANCE;
int a = 0;
public int getA() {
return a;
}
public void setA(int a) {
this.a = a;
}
}
void doFromFirstProcess(){
Singleton.INSTANCE.setA(1);
}
void doFromSecondProcess(){
Singleton.INSTANCE.getA(); //0
}
Why does it not work? What is wrong with my code?