Now in Android: 15 - Android 11 features, AndroidX, videos, articles, and more!

Jacob Jacob 21 April 2020
Now in Android: 15 - Android 11 features, AndroidX, videos, articles, and more!

First of all, Android 11, nothing has changed there. We're still on developer preview two at this time. But there are a couple of features exposed in that release that are worth talking about.

Android 11

First is a thermal API for NDK developers. So if you are not writing native code, you can skip to the next item.  If you're writing NDK code, if you're writing something like a game, and you really care deeply about what is going on with the CPU now, is it going to be throttled, do I need to do something about that, then you can use the new thermal API in the NDK for that.

Also, Michael Hazard published an article about new emulator capability. So again, for native developers, if you pull in libraries that are using ARM binaries and don't have x86 binaries, for example, then you have been forced to do all of your testing either on physical devices, which obviously run ARM code, or on an unaccelerated version of the emulator. But now there are system images released with Android 11 that allow you to run with the special mode where we actually translate ARM code to x86 on the fly so you can take advantage of hardware acceleration and get real emulator speeds for those binaries libraries that you're using.

Also, IME animations-- I kind of went on and on about this last time because I'm kind of excited about that feature. There's a new sample app that Chris Banes published called WindowInsets animation that shows you how to use these new APIs. You can both listen in on the animation events of the keyboard to find out when it is coming in and when it is leaving the screen and then do things accordingly. Or you can also control the animation of the IME. And this sample covers both of those aspects.

AndroidX

In the AndroidX space, there's a few things going on. So there have been some releases because there always are. There are a couple of stable releases that are worth calling out. First of all, EXIF Interface hit 1.2.0 stable release. And this release has support both for writing EXIF metadata to PNG files and for reading and writing EXIF data to WebP. So now that library supports writing to PNG, JPEG, and WebP. And it supports reading from those, which is good, and also reading from various other formats as well.

Also, the Fragment 1.2.4 stable release offers some ProGuard and Lint improvements. There were several libraries that released either alpha or beta version, so you can check those out on the release pages for more information about those.

Speaking of AndroidX, Nick Anthony on the team wrote an article about how to migrate to AndroidX. So migrating to a new version of this stuff-- like, there's a bunch of changes. It's sort of tedious refactoring. Maybe this is something you've been putting off because maybe you don't enjoy that kind of programming. I understand. But it's time. Version 28 of the support library is the last version that will have any bug fixes or any changes at all. And all future and current development is going into AndroidX. So it really is an excellent time for you to actually take that on. Finally, use the tools that we provide and actually migrate to AndroidX. So check out the article for more information about that.

Lots of videos and articles published this time around. Let's see what's going on.

First off, screencast. So in the current world that we're living in right now, it's a little hard to produce sort of the full-on videos that we're used to, because we don't really have access to the studios that we normally do in the company. So sometimes, you can set up a home studio, and it works, and that's great. But maybe it's not for everybody.

Jose Alcérreca has set up a system for doing screencast. And maybe this is something that we will get into more. This is sort of a trial that he's running to see how this thing works. I think it's kind of a nice, efficient way to get the information out there. He walks through some code, he shows stuff going on in Android Studio. There's an audio voice track, where he explains what's going on. It's very efficient. So efficient, in fact, that he covers four topics in four videos in under seven minutes total. So he talks about things like view binding, UI testing, live data, and view model usage, as well as data binding-- so pretty quick, pretty efficient, and pretty useful for some good Android fundamentals that everybody should spin up on anyway, if you're not already there.

Kotlin

There were also a bunch of things published, articles as well as video in the Kotlin space. Manuel Vivo published the video "Kotlin Coroutines 101." He talks about what coroutines are and what problems they solve. Spoiler alert, they simplify asynchronous programming. There you go. Pro tip. He also discusses coroutine cancelation, as well as testing.

Florina Muntenescu posted the next episode of "The Kotlin Vocabulary" series. There are a few of these episodes so far. This one is about inline functions. She posted as both a video and an article in parallel. So inline functions are interesting. If you have a function that takes, say, a lambda argument, that is going to incur some overhead as objects are created on your behalf under the hood. If you declare that as an inline function, that avoids that allocation, so much more efficient. On the other hand, if the function you're calling either doesn't take a lambda as a parameter, or it's really large and complex, then you're not necessarily getting a win by declaring it in one. And the content that Florina goes over the trade-offs there so that you can make the right decision for your code.

Manuel posted an article called "Coroutines and Patterns for Work That Shouldn't Be Cancelled." So let's say you're in a scope, you start some work, and that scope may end at some point. Maybe that activity went away or whatever. But you actually want to work to continue. So how do you do that? So he talked about using custom scopes, as well as some patterns of development to determine when you should actually take this approach.

Jetpack

There were some developments in the jet pack arena. First of all, Tiem Song posted a video called "Assembling Your Jet Pack." So he gives an overview of the APIs of Jet Pack, as well as information about how to migrate to AndroidX, related to Nick Anthony's article that I talked about a little bit earlier. He also goes over a lot about the sunflower sample application, which you should check out as well, which integrates a lot of these APIs together to achieve the goals of that particular application. So go see that for more information.

Pietro Maggi posted the fifth article in an ongoing series on WorkManager called "Customizing WorkManager Fundamentals." In this one, he talks about how to create a custom configuration for WorkManager, as well as information about why and when you might want to do that.

Florina posted another article about recycler view this time. It's called "Merge Adapters Sequentially with Merge Adapter." So typically, with recycler view, it takes a single adapter. Well, what if you have different view types? What if you have one view type for headers, another one for footers, another one for the main content, or maybe multiple for main content? Normally you have to stuff all of that in one single adapter. Using the new API, which is available in the alpha 02 release of recycler view 1.2.0, you can use this new API called Merge Adapter. And you can have multiple adapters and then this new API merges them together. All right.

Manuel posted an article which offers cheat sheets for Dagger. It shows you the code that is generated by dagger for various annotations. There is also some helpful links in there. If you're doing Dagger development, there's a guide on dependency injection. There's a Codelab using Dagger in Android. And there's also a presentation that Manuel did on the future of Dagger and Android.

Also in the Jet Pack space, Sean McQuillan has updated the Jet News sample for Jetpack Compose. Jetpack Compose is now at dev 08 release version. And Jet News is now synced to that and uses the new fluent API for modifiers, as well as some other API changes.

In Android Studio, Murat Yener posted an article on the new Layout Inspector tool in the beta release of Android Studio 4.0. So we've had Layout Inspector of various forms for years and years. But it's been rewritten lately with a lot of powerful features. So you should check out this update for things like-- you can actually see live updates as you're interacting with the app on the screen of the device, you can see that interaction. Instead of the more static view they were used to from Layout Inspector, you can see those updates on the screen directly, in the tool. You can also look at property resolution. You can click on the value of an attribute and see where it was defined, see which XML file that was defined in. And there's also a 3D visualization mode, which is visually cool but also useful for understanding the actual hierarchy of views, as well as containers in your application. You can spin it around and sort of see how that parent hierarchy works in practice.

ADB podcasts

Finally, there was one ADB podcast since we talked last. It's ADB 135, called "Audio Podcast." So we talked to Phil Burke on the audio engineering team, as well as Don Turner on the Developer Relations team about audio, about latency, and about this library called OBO, which is for native developers or developers that want to use native capabilities, that it's specifically created for simplifying getting a low latency audio on Android. So check out that podcast, check out the library, and check out everything else here. As usual, everything I talked about here is linked in the article, and the article is linked probably down below in the description. So if you want faster access to any of this information, go check that out.

 

Comments (0)

    No comments yet

You must be logged in to comment.