What’s up guys? Another Google IO has passed and with it some exciting announcements for all the Android developers out there in terms of software and hardware. Here I list some of the changes and additions that I had the chance to check out at the IO and think are worth to mention, if I’m missing anything let me know in the comments
Technically, this was not an IO announcement since it has been around for some months already and many developers have been using it to test their apps, still it’s worth to mention as the next wave of features will come with this new Android version.
If you have a supported device and would like to try the version of Android before the others (you should be OK trying potential buggy features) you can visit the Android Beta Program site to enroll any of your supported devices.
At the IO 2018 Kotlin was announced as an official supported language to build Android apps, way before that developers were already using it in detriment of Java for it’s concise and modern syntax, rich set of features and interoperability with other JVM languages right out of the box. Now Google has announced that “Android development will become increasingly Kotlin-first. Many new Jetpack APIs and features will be offered first in Kotlin”. So, it’s a good time to start using Kotlin if you hadn’t.
Personally, I think is one of the most exciting features in the list as this is a potential game changer in terms of the development lifecycle itself. From the docs:
Jetpack Compose is an unbundled toolkit designed to simplify UI development. It combines a reactive programming model with the conciseness and ease of use of the Kotlin programming language.
This framework allows you to take advantage of Kotlin’s ability to write DSL to define all your UI right into your code in a beautiful and declarative way. You simply need to describe your UI as a set of Composable functions and the framework will handle the rest, even performing optimizations under the hood and automatic updates to the view hierarchy. A Compose application is made up from functions annotated with @Composable that define how the UI will look and behave:
The above code will produce the following UI without a single line of XML layout written:
It’s worth to note that this is on really early stage of development but we will definitely keep an eye on Jetpack Compose.
This is a Jetpack support library built on top of Camera2, it looks to provide a more consistent experience across most devices without the developer needing to write device-specific code, it uses a simpler, use case-based approach that is lifecycle-aware.
- Right-to-Left (RTL) mode support
- Vertical Paging
- Improved dataset change notifications
Say goodbye to findViewById, the idea behind ViewBinding is that you won’t need to clutter your codebase with boilerplate code just to get reference to your views or use an annotation processor to do the job. So instead the binding code will be generated from XML layouts directly at compile time and it will be null-safe and type-safe! Here is an example of how it would work:
With the given layout a SearchItemBinding class would be generated to inflate the XML and get the references, again it is type-safe so it knows that the correct type of packageName is TextView. No more boilerplate code to get the references or annotation processors slowing down your builds!
A lot of good stuff going on, I’m particularly excited about Jetpack Compose and want to see how it behaves on real world applications, but we will have to wait for a while before that. Let me know what are you looking forward to or if I’m missing something important.