Ice Cream Sandwich SDK Curiosities
For every Android release, I go through the API Differences report and see what shows up, clicking on various items of interest (usually things I am covering in a book somewhere). In addition to expected changes, I frequently encounter some stuff that ought to be better publicized. Here’s the crop of those from the Ice Cream Sandwich (ICS) release:
-
Previously, we were told to honor
getBackgroundDataSetting()
and not try to use the Internet from a background service if this method returnedfalse
. Now, this method is deprecated — presuambly tied to the new network/bandwidth management screen. Now, with API Level 14, we need to examinegetActiveNetworkInfo()
— if we are not to be using the Internet for whatever reason, this will returnnull
, as if there was no network connection at all. -
2D hardware acceleration is on by default if you target API Level 14 or higher, though you can disable it on a per-widget basis using the
android:hardwareAccelerated
attribute in your layouts. -
If you target API Level 14 or higher, your default theme will be
Theme.DeviceDefault
, whose look will change based upon device manufacturers’ design decisions. If you want to attempt to blend in better on the device, you will want to stick with this base theme and modify as few settings as possible (as anything you change may work on one device but not others). If, instead, you set up your application to useTheme.Holo
as its base, that theme will not be modified by manufacturers, so you can feel more confident that your app will look internally consistent, particularly if you are making lots of customizations. -
Fading edges on widgets are now dropped from the UI standards, so if you target API Level 14 or higher, they apparently will not appear, unless you use
android:requiresFadingEdge
to override this. -
The contacts API got smacked around again, though at first glance it appears that the changes are only additions, so existing code will (hopefully) still work.
-
There is a new
Switch
widget, which is yet another variation on theCheckBox
/ToggleButton
concept. There is a correspondingSwitchPreference
as well.