Illustration by Virginia Poltrack

Now in Android #15

Android 11 features, AndroidX releases and migration guides, screencasts, videos and articles about Kotlin, Jetpack, and Android Studio, and an audio podcast about… audio

Chet Haase
Apr 8, 2020 · 7 min read

Welcome to Now in Android, your ongoing guide to what’s new and notable in the world of Android development.

NiA15 in Video and Podcast Form

Video

Podcast

Android 11

Android dialed up to 11

No new developments with Android 11 release this time: it’s still in Developer Preview 2, which I talked about in the previous episode. But there were a couple of things related to the release that are interesting to pass along:

🥵 Can You Take the Heat?

System Images for Running Native ARM Apps on the Emulator

If your app is written completely in Kotlin or the Java programming language, this doesn’t affect you. But if you use native libraries which only have ARM binaries, then you have been unable to use the x86-accelerated emulator capability on x86 machines. Instead, you had to test your app on either a physical devices (which use ARM natively) or with a much slower emulator image.

Now, with the new ARM-compatible system images included in the Android 11 release, we are able to translate from ARM to x86 instructions, which enables the emulator to take advantage of hardware acceleration and maintain performance when running ARM binaries.

IME Animation Sample App

Last time, I went on and on about my favorite feature in Android 11: IME animations. This new platform feature allows applications to listen in on the progress of the animations so that they can adjust their content accordingly. Also, conversely, they can control the animation of the keyboard directly.

Chris Banes has written a sample to show how to do this, WindowInsetsAnimation, which shows both how to react to the IME coming entering and leaving the screen and controlling the IME’s entrance/exit.

AndroidX

  • ExifInterface 1.2.0 adds support for writing EXIF metadata to PNG files and reading/writing EXIF for WebP. Now ExifInterface handles writing to PNG, JPEG, and WebP (as well as reading from various other file types).
  • Fragment 1.2.4 offers Proguard and Lint improvements.

There were also several AndroidX libraries hitting various stages of beta and alpha, so check out all of the releases for more details.

The Great Migration

If you’ve been putting this off, this is a good time to finally do it. The Support Library is at the end of the line; version 28 was the last one which will receive any fixes, so make your way over to the future-bound AndroidX versions instead.

Videos and Articles

Screencasts

Jose Alcérreca posted four new screencasts demonstrating some foundational Android development techniques. These videos cover View Binding, UI testing, LiveData and ViewModel usage, and Data Binding. Not bad for just seven total minutes of content.

Kotlin

Manuel Vivo posted the video Kotlin Coroutines 101. In this presentation, Manuel explains what coroutines are and what problems they solve (spoiler: they simplify asynchronous programming). He also discusses coroutine cancellation and testing.

Florina Muntenescu posted the next episode in the Kotlin Vocabulary series, in both video and article form. This time, she discusses inline functions. Inline functions cause the compiler to copy the function code to the call site, removing the overhead of lambda function parameters which would otherwise cause allocations under the hood. But inline functions are not a panacea. Consider using them when there is actually function parameter overhead to mitigate. Don’t use them for large, complex functions, or you risk bloating your code from all of those copies.

Inline Functions: The video

Manuel posted an article called Coroutines & Patterns for work that shouldn’t be cancelled. Sometimes you want to execute work asynchronously that you’d like to continue running, even if the scope in which you started the work ends. This article talks about how to do that, using custom scopes, and about patterns of development that help determine which approach to use in different situations.

Jetpack

Tiem Song posted Assembling your Jetpack, which discusses the Jetpack APIs, giving an overview of the APIs and how to use them in your application, including how to migrate to the new AndroidX version of the libraries. All new development happens in the AndroidX libraries, not the older Support Library versions. Speaking of migration, be sure to check out Nick Anthony’s article, discussed above, which covers migration in more detail.

Tiem uses the Sunflower sample application to show Jetpack APIs in action.

Pietro Maggi posted the fifth article in a series on WorkManager, Customizing WorkManager — Fundamentals. This article shows how to create a custom configuration for WorkManager, as well as why you might sometimes want to do so.

Florina posted an article about RecyclerView: Merge Adapters Sequentially with MergeAdapter. With this new API, added in the alpha02 release of recyclerview-1.2.0, you can use multiple adapters (which are merged into one— get it?) instead of serving all views from a single adapter.

Manuel posted an article which offers cheat sheets which show the code that Dagger generates for annotations. The article also has helpful links to a guide on dependency injection, a codelab using Dagger in Android, and a video on the future of Dagger in Android.

Also in Jetpack: Sean McQuillan updated the JetNews sample app for Jetpack Compose to sync with the latest release of Compose, dev08. This version uses the new fluent API for modifiers, among other changes.

Android Studio

Murat Yener posted an article on the new Layout Inspector tool in the beta release of Android Studio 4.0. Layout Inspector is not new, but it’s been rewritten with many powerful features, including live updates as you interact with the app on a device, property resolution that allows you to jump to the code where an attribute is defined, and a 3D visualization mode that allows you to better understand the view and containment hierarchy in your app.

ADB Podcast Episodes

ADB 135: Audio Podcast

Now then…

Android Developers

The official Android Developers publication on Medium