objects ahead of time is an important optimization. Initialize your stuff in OnAttachToWindow() method when possible. If you do not need complex measurement just use onSizeChanged() method. If you define own views, ensure you review the ViewConfiguration class. When using custom attributes always recycle your TypedArray. Tips and tricks