You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our internal developer survey shows that our developers want to keep Android Lifecycle methods together (for Activities and Fragments), in the correct order and before all other methods. They should not be sorted alphabetically like all other methods. #6
Why is this beneficial?
Activities and Fragments should not contain business logic instead those classes provide callbacks for the Android Framework. Those methods are called in special order. Having this order in code helps to know when things are ready to be called.
When sorting those methods alphabetical and mix them with all others, they can end up in wrong order (although it actually works most of the time) or mix with other methods which are completely unrelated.
Activity lifecycle methods are protected whereas Fragment ones are public. When grouping by visibility those from Activity end up after all public methods. Especially those should be moved right after the constructor.
The text was updated successfully, but these errors were encountered:
Our internal developer survey shows that our developers want to keep Android Lifecycle methods together (for
Activities
andFragments
), in the correct order and before all other methods. They should not be sorted alphabetically like all other methods. #6Why is this beneficial?
Activities
andFragments
should not contain business logic instead those classes provide callbacks for the Android Framework. Those methods are called in special order. Having this order in code helps to know when things are ready to be called.Activity
lifecycle methods areprotected
whereasFragment
ones arepublic
. When grouping by visibility those fromActivity
end up after allpublic
methods. Especially those should be moved right after the constructor.The text was updated successfully, but these errors were encountered: