Some time ago on the Android phone system to develop a small thing, first introduce him: that is, when the finger click on the screen wherever the time will appear when 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 bubbles, flowers blooming and so on! Here I give the effect to a name: Magic finger. Perhaps I will be writing 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 no matter what interface, that is, no matter what activity (no matter what the app), and can also 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_ at the same time. The static variable that records the state of "magic finger" inside the tool! Everything looks flawless! But reality is cruel! The actual effect is that you simply can't get the real current "magic finger" status!
What is this for?
Apps executed on Android are not actually executed on a virtual machine, and an app execution requires the system to assign him a separate virtual machine, which means that every app on the Android system is executed on its own standalone virtual machine! Therefore, the static singleton mode is not visible to the app! So all the ideas are a dream!
The injustice caused by the static of Android development