0 Flares 0 Flares ×

There are a lot of exciting new features in SDK 3.0 and Studio 3.0 we’ll be talking about more in the upcoming days. But as with any major release, there are also a few gotchas. We try to be as transparent as possible about important changes that could impact your development. So as we’re getting ready to roll out the latest version of the Titanium SDK, 3.0, there are a few things that developers should be aware of before updating.

The following changes may break existing applications working on SDK 2.1.4 and earlier:

  • Android TabGroup changes
  • Android ActivityIndicator changes
  • End of official support for the Android Rhino runtime
  • Removal of APIs deprecated prior to 1.8
  • iOS group TableView background changes (2.1.4 change)

Android TabGroup Changes

The changes made to enable the action bar on Android required changes to the way that TabGroups operate. These changes affect all android applications that use tab groups, whether or not they use the action bar.

Action Bar Tabs

When building an application with targetSdkVersion of 11 (Android 3.0/Honeycomb) or later, tab groups will be represented with action bar tabs, instead of with the older-style tab group. If you are already building your application with targetSdkVersion of 11 or later, the appearance of your tab groups will change when you build with SDK 3.0.

A subsequent blog post will describe how you can take advantage of the action bar in SDK 3.0.

TabGroup Activities

In previous versions of the SDK, each tab group window was in its own activity. In SDK 3.0, the tab group has its own Android activity (exposed as TabGroup.activity). The individual tab windows all share the same activity. This may affect you, for example, if you are creating a different options menu for each window, since you can only associate a single onCreateOptionsMenu callback with the tab group.

To switch menu items when the tabs are switched, you can use the new Activity.invalidateOptionsMenu method whenever you want to change the contents of the options menu. For example, you could call invalidateOptionsMenu in the focus event handler for each tab window, and add logic in the onCreateOptionsMenu callback to create the appropriate menu items for the active tab.

Application Title Bar

In previous versions of the SDK, the tab group was automatically set to fullscreen, so no title bar appeared. In SDK 3.0, the window title bar is shown by default, as it is for iOS tab groups.

To restore the previous behavior, set the TabGroup.navBarHidden property to true. This property, which works identically to the Window.navBarHidden property, is new in SDK 3.0.

Android ActivityIndicator Changes

In SDK 3.0, the Android ActivityIndicator has been reimplemented to create parity with iOS and Mobile Web. The old ActivityIndicator presented a modal dialog on Android. The new ActivityIndicator is a view that must be added to another view or window in order to be displayed, as on iOS and Mobile Web. (Unlike the iOS activity indicator, however, the Android activity indicator can’t be placed in the window title bar.)

In addition, Android and Mobile Web now support Ti.UI.ActivityIndicatorStyle, which contains the same constants as Ti.UI.iPhone.ActivityIndicatorStyle. iOS will support Ti.UI.ActivityIndicatorStyle in a subsequent release.

A new, Android-specific ProgressIndicator object replaces the old Android activity indicator. You can use ProgressIndicator to create either a modal dialog or a progress bar in the window title.

Code using the old Android activity indicator will break, since the new activity indicator must be added to a view. To update code for 3.0, you can switch to using the new activity indicator like you do on iOS or Mobile Web. Or to retain the previous behavior, switch to a ProgressIndicator.

For example, given the sample code for ActivityIndicator in prior releases:

This legacy code looks different on iOS and Android and won’t work at all on Mobile Web. But a few small changes gives you the same results on all three platforms:

To use the modal activity dialog instead, you’d add code something like this:

Like activity indicator, you must call show on the progress indicator to make it appear.

End of Official Support for Rhino Runtime

The Rhino runtime is no longer officially supported in SDK 3.0. With most developers using the V8 runtime exclusively, the decision was made to stop supporting Rhino in order to avoid spending development and test resources maintaining two runtimes.

As a result, Titanium Studio 3.0 no longer presents the Rhino runtime as an option when building with SDK 3.0 and later. Rhino is still included with the SDK, and may still be enabled by manually adding the ti.android.runtime property to the tiapp.xml file.

Removed APIs

The following APIs are being removed in this release. All of these APIs were deprecated prior to Release 1.8.

APIRecommended Replacement
Titanium.Media.VideoPlayer.contentURL Use the url property instead.
Titanium.Network.addConnectivityListener Use the change event to monitor connectivity changes.
Titanium.Network.removeConnectivityListener Use the change event to monitor connectivity changes.
Titanium.UI.ImageView.url Use image instead.
Titanium.UI.orientation property Use Titanium.UI.Window.orientationModes instead.

iOS Group TableView Background Change (2.1.4 Change)

This change is not new in 3.0, but it caused confusion for some users in 2.1.4, and other users may be seeing it for the first time in 3.0.

In SDK 2.1.3 and earlier, an iOS group TableView defaults to a transparent background color. To obtain the iOS system background texture for group table views, you must specify it explicitly by using a color of "stripped" (sic) or Ti.UI.iPhone.COLOR_GROUP_TABLEVIEW_BACKGROUND. (The system texture is a pinstriped blue background on iPhone and iPod touch, and transparent on iPad.)

In SDK 2.1.4 and later, the logic is reversed: a group TableView uses the iOS system background texture by default. If you want the background image of an underlying view or window to show through, you must explicitly set the table view background color to "transparent".

This is related to a change in iOS 6. iOS 6 removed support for explicitly specifying the default group tableview background texture as a color. Using the Titanium SDK with previous versions of iOS, you can specify either "stripped" (sic) or Ti.UI.iPhone.COLOR_GROUP_TABLEVIEW_BACKGROUND anywhere a color is required, and iOS will render the striped texture. If you specify either of these values on iOS 6, iOS renders it as black instead.

Stay Tuned For More

Watch this space for more updates on SDK 3.0 and Studio 3.0.