Android Activities are one of the most important parts of an application's overall lifecycle. The way activities are launched and how developers manage all of them together is a fundamental part of the platform's application model.
💡 In order to improve performance, developers need to review and optimize how they handle different activity states while providing a fast experience.
So far, Apptim captures two indicators about activities in Android:
- Amount of Activities: the number of Android activities used in the app
- Activities stack: the number of Android activities put into the 'Back Stack'
Layouts are a key part of applications for modeling UI, impacting directly the user experience.
💡 A poorly implemented layout can lead to a CPU and/or Memory hungry application with slow UIs.
So far, Apptim captures two indicators about layout in Android:
- UI controls count: the amount of UI Controls in each screen
- Nested layouts level: how deep layout nesting is in each screen
Amount of activities
All non-trivial Android applications are made up of a number of different functional screens and hence, multiple activities. Although multiple screens allow for building complex applications, they also require careful management. In particular, developers need to deal with activities that are no longer visible since Android OS will place them into the background and may terminate activities that are not used for a period of time. The use of multiple activities also requires careful consideration of the interaction and navigation model that the user will experience, so typically it's safer to manage a fewer amount of them.
Navigating to multiple different activities causes Android to put them into the 'Back Stack' in order to save states such as text form, scroll position, and other data. Multiple tasks can be held in the background at once. However, if the user is running many background tasks at the same time, the system might begin destroying background activities in order to recover memory, causing the activity states to be lost. On the other hand, having several activities on the back stack will cause a bad user experience, since the user will probably found confusing to press the "back" button more than 4 or 5 times to use different features.
UI controls count
This shows the amount of UI Controls in each screen in order to be aware of the UI complexity and rendering effort.
Nested layouts deep
It is a common misconception that using the basic layout structures leads to the most efficient layouts. However, each widget and layout added to an application requires initialization, layout, and drawing. Layouts with too much nesting are bad for performance. So, measuring how deep the layout nesting is can guide us to correlate slow UI experiences as well as high GPU usage.