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
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 the 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 carefully considering the interaction and navigation model that the user will experience, so, it is typically safer to manage less 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 in the back stack will cause a bad user experience, since the user will probably find it confusing to press the "back" button more than 4 or 5 times to use different features.
UI controls count
The amount of UI Controls helps you be aware of the UI complexity and rendering effort.
Nested layouts level
It’s 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 layout nesting is can guide you to correlate slow UI experiences as well as high GPU usage.
To get more details on how to analyze the Activities Stack and Layout structure of your Android app, click and expand the video below: