The injustice caused by the static of Android development

Source: Internet
Author: User

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.