Taking Android UI development to the next level
There’s an old proverb that says something like, “a worker is only as good as their tools,” and the same holds true for programmers.
The productivity of a developer often depends on the tools they have available. Whilst a better set of tools won’t necessarily transform a poor developer into a good one, they can significantly reduce the amount of time and effort required to complete a task.
During our recent online technical session, we were fortunate enough to speak with Anna-Chiara Bellini, Product Manager for Jetpack Compose at Google, to gain insight into the future of native Android UI development and the implications it may have for the developer community.
Approximately one month ago, we launched Jetpack Compose – the new native user interface tool for Android. This modern, native UI toolkit allows users to create UIs in a quicker and more intuitive way, with fewer lines of code.
Making the switch to a declarative model
Anna highlights that the main objective was to simplify the process of creating a user interface for an application by utilizing the declarative attributes of the toolkit.
In the past, constructing even a simple user interface took significant effort in terms of coding. For instance, with the previous toolkit, it was necessary to manually create the XML for the layout, load the associated resources, and animate the individual components.
The original UI toolkit was developed at a period when user interfaces were notably simpler and less advanced than they are now.
Android programming traditionally required multiple steps to construct the user interface, which posed an issue in that some state information was stored in XML, while other parts were stored in different views. This made transitioning between states quite difficult.
Jetpack Compose employs a declarative framework where the state is pushed to the UI in a unidirectional way.
She stated that the user interface (UI) can only be adjusted by modifying the state. Therefore, a state must be established first for the UI to be constructed. Subsequently, a second state can be built which will lead to a separate UI. This is the only way to make changes to the UI.
The upshot of this modification is that the hard work has now been relocated from the developer to the toolkit.
It is essential to consider that code written by an individual is not necessarily the only code to be executed. Those who desire to control individual pixels must alter their approach. Fortunately, there are strategies to help with this, and we have aimed to make them as straightforward as possible.
Bellini attributes the success of Compose to the involvement of the community. All of Composer’s code is open source, allowing us to collaborate externally and receive feedback from a greater pool of expertise. This enabled us to go beyond relying solely on our internal resources and ensured a wide breadth of knowledge. Our technical team is outstanding, however the community collaboration was integral to our success.
We aimed to assist individuals in achieving results. We understand that spending time ensuring that things operate efficiently is not an enjoyable experience. By establishing a closer connection between your ideas and the outcome, the process of app development can become more enjoyable.
Increasing in energy
Animation has always been a challenge, so we have made it a priority to keep animations simple in Compose. As Bellini mentions, modern UIs are dynamic and utilize motion extensively. Furthermore, we have taken into account the increasing number of form factors that Android supports, such as phones, tablets, Chromebooks and wearables.
As a Product Manager, the greatest satisfaction comes from creating a product that people want to use, and that brings them pleasure. When we released our initial Animation API, developers quickly took up the challenge and began creating animations that were previously unimaginable. It is the greatest reward for a Product Manager.
If you found Anna’s online technical training interesting, check out our other on-demand webinars for additional crucial insights!
Are you a developer interested in developing your software engineering career? Apply to join the Works Talent Network now.