Some time ago on the Android phone system to develop a small thing, first introduce him: that is, when the finger click anywhere on the screen will appear the effect of the click, that is, you click on the screen where there will be a variety of effects, such as: snowflakes swirling, the appearance of colorful soap bubbles, flowers blooming and so on! Here I give the effect to a name: Magic finger. Later I will write a blog to describe how to achieve! Here is the main point of the development of a problem encountered.
Because, my implementation of this effect is in any interface, that is, in any activity (any app), but also can be set up in the phone settings of different click Effects! or turn on "Magic Fingers". Smart I first thought of a static variable to record the "magic finger" of the various states! So you don't have to read the database every time to update the "magic Finger" state.
So, I defined a tool class for "Magic Fingers": fingermagic_tool. And this tool class I am using a single-column mode, in this tool class I set a static variable to record the "magic finger" of the various states! When I configure a new "magic finger" status in the settings of my phone system, I go to update fingermagic_ The static variable that records the state of "magic finger" inside the tool! Everything looks flawless! But the reality is cruel! The actual effect is that you simply can't get the real current "magic finger" status!
What is this for?
apps running on Android are not actually running on a virtual machine, and an app running requires the system to assign him a separate virtual machine, This means that every app on Android is running on its own standalone virtual machine! Therefore, the static singleton mode is not visible to the app! So all the ideas are a dream!