I am told that the Activity.findViewById(int) method is a convenience method that calls View.findViewById(int) behind the scenes.
I am unable to find any documentation for explaining convenience methods wrt Java (I can see only iOS).
PS : I am unable to find any answer during my cursory Google search or via SO prev posts.If there is already one do point out so that I will close this one.
convenience method (plural convenience methods) (object-oriented programming) A method created for convenience so that some other, more complex task can be solved more easily.
A "convenience method" or "convenience class" generally means a class that doesn't do anything itself, but provides simplified access to other classes or groups of classes. For example, the "random()" method in java. lang. Math is a convenience method that provides a simple way to use the more powerful java.
A convenience method, in any language which has a concept of methods, is just that. A method that makes things more convenient.
This usually means taking something that is complex or verbose, and making it more accessible. Examples include pretty much everything in helper classes like Collections
or Arrays
. As well as factory methods (to a certain extent, there are reasons for factories beyond simple convenience).
For a more formal definition from Wikipedia (http://en.wikipedia.org/wiki/Convenience_function):
A convenience function is a non-essential subroutine in a programming library or framework which is intended to ease commonly performed tasks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With