Welcome to Now in Android, your ongoing guide to what’s new and notable in the world of Android development.
Now in Android #12: the Video Version
Now in Android is also offered in video form. It’s the same content, but with more movement and less text to read. Check out the video here or ignore it and continue with the text below.
Now in Android… Now in Video and Audio
Now every episode should be coming to you in the ‘classic’ form of these articles on Medium. In addition, there will be a video version of the article where I talk to the camera about that same content, posting it in the new Now in Android playlist on the Android Developers channel on YouTube.
And as long as we have the video, we’re taking the audio from it to publish a new Now in Android podcast, which is now available wherever you consume podcasts.
Now in Android
This show gives listeners a quick run-down on things that the Android team has done recently that developers may want…
Also, I’m changing the episode titles (again!) to be the same across all of these formats. So starting with this episode, the number of this article (#12) should match the number of the related video and podcast. I’m doing this because even if you prefer video or audio as your format of choice, you might still want to visit that episode’s Medium article for its handy links.
So get your Now in Android updates however you prefer: it’s the same content, just a different delivery mechanism. Then check back every couple of weeks (ish) for the next one, because the one true thing about software is: there’s always more.
AndroidX had some interesting library releases recently.
First, there were a few stable release. Most, like Fragments, Media2, Navigation, and WorkManager, were mainly bugfixes. But there was also a release of Core 1.2.0 with new functionality for Notifications, BlendMode (providing new platform functionality for older releases), ShortcutInfo, and WindowInsets. Also, note that ViewModel-SavedState 2.2.0 is exactly the same as 1.0.0; it’s just upping the version number to sync with the same version number as the other Lifecycle artifacts.
There were also a couple of new libraries that have just hit alpha for the first time ever:
Navigation 2.3.0 includes new dynamic features navigation (see below), along with a new navigation-testing artifact.
Navigation and Dynamic Feature Modules
Q: What’s better than a new API?
A: An existing API that does new things.
Wojtek Kaliciński and Ben Weiss have been working on a new API in the Navigation Component which makes dynamic feature modules easier to use, using the same Navigation API you’re already using for non-dynamic destinations.
First, some history and terminology:
Android App Bundles is the new application format (the first since the invention of the APK!) which allows developers to upload a superset of what all users need. Then the Play Store determines the subset (based on device configuration) to install on any given device. This gives developers an easier way to target all possible scenarios without having to upload many different APKs, while allowing the Play Store to reduce download sizes to only what’s needed.
Dynamic feature modules provide developers the additional capability of splitting their app into separate pieces (modules) which do not necessarily need to be installed immediately. That way, an app can be installed with some minimal subset needed on first launch, and later modules (say, additional assets for optional paths through the app) can be installed later, as needed.
Developers can use APIs in the Play Core Library to manually request the download and installation of dynamic feature modules.
But now, using the version 2.3.0 of the Navigation Component, dynamic feature modules are even easier. You can use the usual call to navigate(). When the destination is in a dynamic feature module, the library will take care of the details of downloading and installing the required pieces.
The library is currently in alpha, so maybe it’s not quite ready for your production code. But if you want this functionality, please play with it and send us feedback. Check out the docs for more information, and try out the sample which Ben Weiss posted just last week.
Florina Muntenescu continues her Kotlin Vocabulary series with this article on inline classes, an experimental feature in Kotlin 1.3.50.
Inline classes can provide an enhanced level of type safety for variables which might otherwise conflict and cause runtime errors. Better yet, they can do so without introducing any overhead* by compiling into code that simply uses the underlying type instead of actually creating the class that wraps the type.
* Depending on how you use the class. See the article for the details and gotchas.
Android Styling: Themes vs Styles
The Android styling system offers a powerful way to specify your app’s visual design, but it can be easy to misuse…
It is easy, and common, to confuse the concepts and usage behind themes and styles. After all, they both use the <style> tag, so they look very similar from the outside.
Nick Butcher started a new series of articles to help explain this area of Android development more deeply.
In this first article of the series, Nick looks at the difference between themes and styles, and areas where developers might choose one over the other.
ADB Podcast Episodes
There was an episode of Android Developers Backstage posted since the last Now in Android. Check it out at the link below, or in your favorite podcast client:
ADB 132: Storing data with Store
Episode 132: Storing data with Store
In this episode, Chet and Romain talk with Yigit Boyar, from the Jetpack team, and Mike Nakhimovich from Dropbox. Mike…
One of the patterns for data storage and retrieval that we recommend in our Guide to app architecture is to use a Repository, which provides an abstraction layer on top of where that data comes from. For example, you might have data stored in a cache locally as well as in a server on the other side of the network. This approach allows your code to fetch the data without worrying about where the data lives or how to get it, leaving those details up to the Repository.
It’s great to have a suggested technique, but wouldn’t it be even better to have an API that made that part easier?
The Store library (currently in alpha) does just that. On this episode, we talked with Mike Nakhimovich from Dropbox and Yigit Boyar from the Android Toolkit team. Mike leads the development of the Store open-source library (which Yigit also hacks on in his spare time).
That’s it for this time. Go check out the Now in Android video series and podcast! Try the latest AndroidX releases! Check out the new Navigation library for navigating with dynamic feature modules! Read the articles on inline classes in Kotlin and themes vs styles! Listen to the latest ADB podcast episode! And come back here soon for the next update from the Android developer universe.