Skip to content

Instantly share code, notes, and snippets.

@tonylukasavage
Created August 7, 2012 13:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonylukasavage/3285234 to your computer and use it in GitHub Desktop.
Save tonylukasavage/3285234 to your computer and use it in GitHub Desktop.
Alloy lifecycles

Underscore prefix indicates that the function is created and performed by Alloy. All non-Alloy functions below will be optional;

  • __init - Establish $ as this
  • prelayout - Before any UI is created. Good time to update Alloy.CFG with runtime values for use in styles.
  • __layout - All UI elements are created and added to the view hierarchy
  • postLayout - Everything is prepared, this is where the bulk of the code will go and where beginners will spend all their time.

Underscore prefix indicates that the function is created and performed by Alloy. All non-Alloy functions below will be optional;

  • __init - Establish $ as this
  • onInit - Before any UI is created. Good time to update Alloy.CFG with runtime values for use in styles.
  • __create - Create the UI elements, but don't yet add them to a view hierarchy.
  • onCreate - UI elements are created, but not put in a view hierarchy yet. Here you could manually add or manipulate the UI elements in the current class, or a subclass.
  • __layout - Build the view hierarchy
  • onReady - Everything is prepared, this is where the bulk of the code will go and where beginners will spend all their time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment