I’m curious about how android detects whether i called super.onCreate (or some other methods) in my onCreate method.
I guess it uses a flag and saw a flag boolean mCalled; in Activity.class, but not sure if it’s for this detection. If it is, then it makes me confused because there are many supermethods to override but only one “mCalled” flag for those methods to detect if supermethod is called, seems impossible.
thx for reply~
The pattern works like this:
If you go through the code, you’ll find that the flag is used by the framework for only one method at a time. So even though there are many methods that require calls to
super.whatever(), they can share the same flag.