Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upKeep Lifecycle methods together #3
Closed
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Our internal developer survey shows that our developers want to keep Android Lifecycle methods together (for
ActivitiesandFragments), in the correct order and before all other methods. They should not be sorted alphabetically like all other methods. #6Why is this beneficial?
ActivitiesandFragmentsshould 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.Activitylifecycle methods areprotectedwhereasFragmentones arepublic. When grouping by visibility those fromActivityend up after allpublicmethods. Especially those should be moved right after the constructor.