The injustice caused by the static of Android development

Source: Internet
Author: User
Tags what interface

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

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.