Image for post
Image for post
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 · 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

This Now in Android is also offered in video and podcast form. It’s the same content, but with less reading required. The article version (keep reading!) is still the place to come for links to all of the content that’s covered.

Video

Podcast

Click on the link below, or just subscribe to the podcast in your favorite client app.


Android 11

Image for post
Image for post
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?

First of all, for those native programmers out there (you know who you are), the NDK released with Android 11 Developer Preview 2 added the Thermal API, which allows developers to find out the current state of the device so that they can react accordingly.

System Images for Running Native ARM Apps on the Emulator

Michael Hazard on the Android Studio team posted an article on the Android Developers Blog about faster emulation for ARM binaries.

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

Image for post
Image for post

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

Many AndroidX libraries were released in early April, including the following stable releases:

  • 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

Speaking of AndroidX, Nick Anthony wrote an article on how to migrate to AndroidX from the previous Support Library version of these libraries.

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

Normally, I list videos and articles separately in Now in Android. But whenever possible, we try to release developer content in both formats (software is all about reuse!). So in an attempt to make things less confusing here with the content overlap, I’ll try blending articles and videos together this time.

Screencasts

In the current situation in which all of us are working from home, recording videos is… not as easy as it was when we had professional recording studios and production teams. But it turns out that everyone can still write code and explain it, so screencasting might be the developer video of the future (or at least the present).

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

There were a few articles and videos posted about Kotlin development:

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

There were a few things posted about various Jetpack APIs that are worth checking out.

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

Image for post
Image for post

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

There‘s been another Android Developers Backstage podcast posted since the last Now in Android. Check it out at the links below, or in your favorite podcast client:

ADB 135: Audio Podcast

It was appropriate that our first fully-remote podcast (where we were all recording ourselves from the luxury of our own closets) took place with guests who work on audio technology. We talked with Phil Burk, an engineer on Android’s audio team (whom we spoke with way back in episode 39 about MIDI on Android), and Don Turner, from the developer relations team, about audio latency and about Oboe in particular. Oboe is a native (read: C++) library that makes it easier for developers to achieve lower latency audio on Android.


Now then…

That’s it for this time. So check out some of the Android 11 features and APIs! Go get the latest AndroidX releases! Watch some screencasts and the latest videos on the Android Developers channel! Read some Android developer articles! Check out the latest ADB podcast episodes! And come back here soon for the next update from the Android developer universe.

Android Developers

The official Android Developers publication on Medium

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store