New Android SDK releases are always exciting! We’ve compiled some of the main changes in the SDK, compatibility package, and tools that developers should be aware of.
New API features
If you are feeling adventurous and want to add some 4.0-specific features to your app, such as resizable widgets or Android Beam functionality, they are all well-documented on the Android Developer blog. We’ve focused more on changes that are relevant to existing apps, since that will affect developers immediately the most.
The full compatibility library changes can be found here, but here are some highlights:
- ViewPager improvements and bug fixes: Google released this ViewGroup a few months back, and it is being used by the official Google+, Calendar, and Gmail apps.
- Support for Accessibility APIs
- Changes to Fragments API, including bug fixes, as well as new API for menus and custom animations
- LocalBroadcastManager allows you to broadcast within an application, rather than globally.
Targeting API 14
If you change your app to target API Level 14, keep these things in mind.
- getBackgroundDataSetting() is deprecated. If you were using it, use getActiveNetworkInfo() instead.
- If you don’t specify a theme, your default theme will be Theme.DeviceDefault, which will be the device’s defaults. If you want to have control over the themes, specify a theme (for instance, Theme.Holo if you were using Honeycomb’s default theme).
Android Development Tools (ADT) Improvements
The Android 4.0 release was complemented by pretty significant Tools upgrades. Xavier Ducrohet has a very comprehensive list here, but I’ll list some highlights:
- Improved build performance in Ant and Eclipse
- Improved XML editor: the Android Eclipse plugin now includes a custom XML formatter. The Android XML formatter allows you to auto-format XML files, and it will use the appropriate styles depending on what kind of xml file it is.
- Logcat improvements: You can now filter by application name or Java-style regexes.
- Easier icon creation: This is available as a webapp but will not be available as part of the Android Eclipse plugin. It makes creating assets for ldpi, mdpi, hdpi and xdpi easier.
- If you installed the latest SDK tools and had migration troubles, you may want to take a look at how library projects are handled now. Also ADT 14 had a few issues (listed here), some of which were fixed in the subsequent r15 release, so upgrade to ADT 15 if you haven’t already.
Ice Cream Sandwich brings some improvements to developer and user-friendly tools on the device. Here are a few:
- Network usage tool: This is included on devices and allows users to see which apps are consuming the most data, as well as restrict data usage after a certain threshold. For developers, it can be useful for easily making sure that your data usage is in control.
- More developer options: It looks like you can enable strict mode, show touches, show screen updates, and other useful options and displays right on the phone.