The last edition of Android Programming: The Big Nerd Ranch Guide was released in October 2019. A lot has changed since then. To help...
Real Talk About Lollipops
It’s that time of the year: a new version of Android has graced us once again. Android 5.0 Lollipop arrived last Thursday, with much hoopla. Unquestionably, Lollipop is the most significant Android release since Android 3.0 Honeycomb more than three and a half years ago.
Big New Changes
Honeycomb turned Android design upside down with Holo and a new set of design docs, and it turned developer implementations on their head with powerful interface architecture tools.
So what’s the story with Lollipop? Part of it is similar: there is a major redesign again, this time called Material, that includes changes to how users navigate within apps.
The other part looks different, though. Instead of a few major concepts that need to be reckoned with, Lollipop has a raft of changes and important APIs, plus one or two sweeping changes under the hood.
Developer Priorities Right Now
Let’s talk about the most important stuff first. What do you need to change right now?
In Android, the targetSdkVersion value in your AndroidManifest usually lets the device adapt to your older applications, rather than the other way around. Lollipop is different, though, because it introduces a new runtime called Android Runtime (ART).
For most apps, ART should work fine. But if you have an app that relies on advanced techniques like adjusting the stack size, JNI or reflection on the Object class, you may need to scramble to be able to run on new Lollipop phones. For the technical details, check out the guide to ART compatibility issues on Google’s Android site. And earlier this year, Kurt Nelson wrote a post about replacing Dalvik with the Android Runtime that you should check out.
Updating the Look of Your App
We strongly recommend that you update the look and feel of your existing apps to fit in with the new Material design. Designers will want to consult the new Material Design documentation for reference, in addition to a forthcoming blog post here.
For programmers, the basic changes and tools are easy, and can be applied across all versions of Android, not just Lollipop. Some of the new graphical sheen will be active only on Lollipop, but your app’s code will be the same as on earlier versions.
The Material theme is available right now: just include version 21 of the appcompat library in your app. Switch your app’s theme to Theme.AppCompat, and you’re good to go.
Material also pushes apps towards more dynamic, animated user interfaces. Developers familiar with the existing tools cannot be blamed if they groan at the prospect of adding the exciting new list and grid animations in their existing ListView code, though. The latest appcompat library introduces the RecyclerView, however, which makes animating items into and out of lists simple. The API is much different from the old ListView, so expect to spend a minute or two familiarizing yourself with it.
New Features, New Apps
Those with apps in some niches should also consider checking out new APIs that are available:
If your app uses the old Camera Java API, look to the new Camera2 API, which is worlds better. It is now possible to configure and program the camera as a pipelined device, not just as a Java object that you call synchronous methods on. This is a big change, but means new possibilities: burst mode, improved video capture and the ability to write richer apps that use the camera in a variety of ways simultaneously. Expect to see some cool new capabilities in Android camera and video apps.
More improvements to audio latency. Because Android has lacked low-latency audio input, apps like iRig (which lets you plug your guitar into your phone and rock out) have suffered from input lag, which makes them unusable for real musicians. In Lollipop, those apps should see improvements.
You can also plug in USB audio devices—something iOS can’t do.
You can now render PDFs on Android out of the box. Many apps were doing this already, but had to rely on licensed libraries to do so.
The Lollipop Market
Historically, it has taken about two years for new Android versions to reach 75 percent of the market. This sounds rough, but most apps are not impacted in practice. That said, if you want to target the new camera API, audio latency, USB audio or PDF rendering features, you will need to either make those features available only on newer devices or limit your market to those devices.
Lollipop is another important step up for Android, and a major release in every way. We continue to be excited to watch where Google is taking Android for app developers and Android users. And of course, stay tuned for updates to our Android bootcamp!