hyperoslo / android-playbook

MIT License
6 stars 2 forks source link

state loss of mutable singleton #17

Open changxiangzhong opened 9 years ago

changxiangzhong commented 9 years ago

Static object could be recycled when the app is in the background at any time. If the states of the static object is changed. Such changing will be lost.

What do you think @Damian-Lopata @ealmdahl @sindrenm @jeantuffier

ealmdahl commented 9 years ago

I think I need an example to understand exactly what you mean. Is this a question or just a statement? If the singleton is mutable and the state is critical to the app, it's probably either a bad design choice or it needs to be able to restore the state in some way?

Damian-Lopata commented 9 years ago

I wasn't aware of that @changxiangzhong before, so good to know. Nevertheless I agree with @ealmdahl - "probably either a bad design choice". We shouldn't use singleton that way.