We know that, in storage, member variables are stored inside the heap in the JVM, while static variables are in the method area of the JVM, the main difference being that the member variables are no longer referenced and often result in recycling, and the method area is very restrictive for garbage collection, unless the entire application is unloaded. Otherwise, the static variable will persist.
Using member variables in Android apps, all member variables are definitely recycled after exiting the app, whereas static variables are reversed. Especially in UI design, if you customize a static ViewGroup, create the time for its addchlid, you have to consider this situation, because again into the program, or will call Addchild method, this will definitely error, if the child is dynamically created, So every time ViewGroup will have a new member to fill in, if child is a member variable or something, because this variable has a static reference exists, so it will not be eliminated, added again will be reported to child can only has a parent error. In another case, if child is also a static variable, then more than one static variable, the memory overhead ... Especially on mobile phones.
In summary, in the UI design to define a singleton mode, feel less reliable, unless there is no sub-component, or to avoid reporting to the child can only has a parent error, to constantly judge whether the children have a father, father, from the father to remove the child (because there is always a static father quoted you).
Re-entry into the program, the different manifestations of Java static variables and member variables and the thinking of singleton patterns