Appcelerator Blog

The Leading Resource for All Things Mobile

Titanium 5.0.0 Sample App

4 Flares 4 Flares ×


This new sample app demonstrates many of the new APIs introduced in Titanium 5.0. Since this release is a big one, we’ve also created separate sample apps for:

We’re working on another sample to demonstrate Windows Runtime Direct API Access as well as the Hyperloop Module for iOS (now available via Appcelerator Labs).

For a list of all the 5.0.0 changes see the release notes and linked JIRA filters.

iOS: Icons & Launch Images

To support App Thinning we now generate Asset Catalogs for the app icons and launch images. In most cases you won’t notice, but be aware that:

  • You no longer need to have any appicon*.png files in assets/iphone. Just provide a 1024×1024 24-bit DefaultIcon.png in your project root and Titanium will generate the missing required sizes for you.
  • The build will fail if your icons do not meet Apple requirements and you don’t provide a valid DefaultIcon.png.
  • You can no longer use launch images within the app itself like this.
  • Localized Splash Screens still work, but App Thinning for these images will not because Launch Images do not support localized Asset Catalogs.

For more information see the iOS graphic asset requirements and options guide. We will add support for DefaultIcon.png to the other platforms soon. Bye bye TiCons 😉

Attributed Strings

The Attributed Strings sample demonstrates the use of the new Alloy <attributedstring> proxy property. You can use this as a child element of <Label>, <TextArea> and <TextField>. As you can see, the last one also supports <AttributedHintText>.

For iOS only, we’ve also added support for the attribute type ATTRIBUTE_LINE_BREAK. Use this with one of the Ti.UI.ATTRIBUTE_LINE_BREAK_BY_* constants found in the sample’s TSS to determine how lines break.

Alloy Themes

Apart from tiapp.xml you can now theme almost everything. We’ve added support for i18n, lib and platform folders. If you have a white-label app you can now easily brand strings, libraries and Android icons, splash screens and themes.


The Alloy sample demonstrates all three new theming features. The last one for Android only, where it should show the thumbs up image of the theme, not the default thumbs down.

Alloy Event Management

Alloy controllers have 3 new APIs to manage event listeners for Titanium view proxies. All events you add via XML now use $.addListener(proxy, type, callback) which is also available to you in the controller. Use $.getListener([proxy], [type]) to get all callbacks or only for a specific proxy and/or event type. Finally $.removeListener([proxy], [type], [callback]) can be used to remove all or specific event listeners. Just like $.destroy() you can call this when the controller’s UI is “closed” to avoid memory leaks, e.g. by calling it in a Window close event.


In the Alloy sample you will find that we add the same callback as listener to the different events on the first button. In the controller you can see that the second button needs only one line of code to remove all listeners from that first button. While you’re in the controller, also observe that when the controller is created we add a third tracked listener to the first button before logging all tracked listeners. When the window closes we remove all event listeners to any proxy or event in one call. See the console logs for details.

More Alloy

The Alloy sample also demonstrates the following new features:

  • You can now use Alloy.CFG.* properties in XML.
  • As well as Alloy.Globals.* variables.


The iOS sample demonstrates a few new API’s:

  • After MobileWeb and Windows Phone, iOS now also supports Ti.UI.ActivityIndicator.indicatorColor to set the color of the indicator.
  • For iPad-only, use showUndoRedoActions on TextFields and TextAreas to determine if iOS 9 should show the undo/redo and copy/paste actions in the toolbar above the soft keyboard. Be aware of TIMOB-19614 when toggling this property.


Android Themes

This release introduces new predefined Titanium themes for Android to hide the action bar and optionally the status bar:

  • Theme.AppCompat.NoTitleBar: Hides the action and title bar
  • Theme.AppCompat.NoTitleBar.Fullscreen: Hides the above plus the status bar.

There are four ways to use the existing and new built-in themes:

  1. Set the android:theme attribute of the Android manifest application element in tiapp.xml to @style/ plus the theme name to apply it to use it as default for all windows.
  2. Set the parent attribute of your custom theme style element to @style/ plus the theme name.
  3. Use it for an individual Window via the creation-only theme property.
  4. Instead, set <navbar-hidden> or <fullscreen> to true in tiapp.xml to select Theme.AppCompat.NoTitleBar or Theme.AppCompat.NoTitleBar.Fullscreen.


Play around with the comments in tiapp.xml to see the different themes in action. You can also change the parent attribute of our custom_theme.xml. Be aware that you need to remove or comment out the <application> element to test <navbar-hidden> and <fullscreen>. The Android sample demonstrates the use of a window’s theme property.

NOTE: If you use a TabGroup in your app then you can not use a theme without action bar. Also be aware of TIMOB-19613.

Android Elevation

Since Titanium 3.3 iOS has viewShadowOffset and now Android gets elevation. Is it the same? Let Google explain why it’s not.


The android sample demonstrates this new property. Use the slider to change the elevation value. As the TSS shows you need to make sure your view has some space around it or else the parent will clip the elevation shadow. The view also needs a backgroundColor since a transparent view wouldn’t cast much shadow.


Other Android APIs

This release supports adding a large icon to be shown in the content area of a notification. As the android sample demonstrates simply set the Ti.Android.Notification.largeIcon property to a system or app drawable, like the big fast forward icon I use:


Also new is Ti.UI.Picker.selectionOpens which determines whether calling the method setSelectedRow() also opens the picker. Tap the button under the picker to see it in action.


Not demonstrated in the sample, but definitely worth mentioning are some new features in the different CLIs:

Appcelerator CLI

Also new on the CLI front are two command for the Appcelerator CLI. The info commands combines the results from appc ti info with information about Appcelerator CLI Installer and Core Package. The other allows you to switch to another org without needing to logout and in again. Pass --org-id <id> if you know the ID. We’re working on making this easier in Studio as well.

appc info
    Display development environment information
appc switch org [options]
    switch logged in org

Titanium CLI

If you clean a project in Studio or via CLI using [appc] ti clean it used to only clean the build folder, but now it also cleans the Resources folder if it’s an Alloy project. Whenever you run into an issue, always first clean to rule out any errors introduced by the incremental builds we do to speed up your development workflow.

Alloy CLI

Thanks to a PR by Kosuke Isobe, Alloy now has some of the new commands Kosuke introduced in alloy-smelter:

[appc] alloy copy <source> <destination>
    copy the controller, view, and style files from <source> to <destination>

[appc] alloy move <source> <destination>
    move the controller, view, and style files from <source> to <destination>

[appc] alloy remove <source>
    remove the controller, view, and style files at <source>


Alloy now supports <CommandBar> for Windows. We’ve also added support for Windows to a lot of API’s of Ti.Media, Ti.Clipboard, Ti.UI.ScrollView, Ti.UI.Switch and Ti.UI.View. Since you’ll know most of these APIs from iOS and Android I haven’t included them in the sample.

Check out this new sample app on GitHub.

In addition to this post, we are also holding a Tech Talk on October 13th to demo these APIs live and answer your questions. Register here.

4 Flares Twitter 0 Facebook 0 Google+ 2 LinkedIn 2 Email -- 4 Flares ×


  1. That’s super neato; your github link has an extra /l at the end that goes 404.

    Hey, I emailed you guys back in July, and I’ve emailed again since, and I’ve tweeted about it, and for some reason you guys still haven’t given me my indie license; can someone look into this please? I’ve been a Titanium dev since 2011 and from July until now I’ve been trying to get my license bestowed! Can someone help?

    • @Dooley The free Indie for life seat was available for those who signed up for the Appcelerator Platform using the same email address that they held a Titanium account with. You then needed to claim your free seat at before June 1st. Did you do that?

  2. Jérémy


    So basically we won’t be able to build Watch OS app in Javascript ? Or it is planned ?

    Thank you for all those new features !

    • Hello Jérémy,

      At the moment we do not support building watchOS 2 apps in JavaScript. You can probably imagine its quite a challenge to get a JavaScript engine and Titanium SDK to run on a watch. It’s currently in R&D.

      • Marcelo

        can you put swift code too ?

        • @Marcelo, do you mean to ask if you can code the watchOS 2 app in Swift as well? Of course, there’s nothing Appcelerator-specific in the Xcode project for the Watch App. It just uses Apple’s Connectivity framework.

  3. Ked

    Hello, first of all THANK YOU!, but i still can’t figure out how to add shadows to android view? I have latest updates, from 27 october, test project with backgroundColor of the window set to #fff and a view inside it with size of 80% and height 50% with backgroundColor #fff, and i didnt saw any shadows… I tested different elevation value from examples (8, 12, 24 etc.) Whats wrong?

    • @Ked Does it work for you in the sample? If you have a reproducible test case that would help.

      • Ked

        Thanks for your reply! Just tested sample on android 5, and it works! Prior 5 version we must use image shadow and etc hacks? I thought native shadows already were in 4.4. But thank you!

        • @Ked only on iOS were shadows supported, but with 5 now also on Android, although elevation is not exactly the same.

          • jayesh joshi (jayeshiphone5)

            If i build with latest SDK and apply shadow to android … will it work for lower version ? or only support since 5.0.0??

          • Yes, the AppCompat library takes care of that.

  4. Ryan

    The first few links to GitHub still have 404 errors.

    • @Ryan, thanks! I’ve fixed them.

Comments are closed.

Sign up for updates!

Become a mobile leader. Take the first step to scale mobile innovation throughout your enterprise.
Get in touch
computer and tablet showing Appcelerator software
Start free, grow from there.
4 Flares Twitter 0 Facebook 0 Google+ 2 LinkedIn 2 Email -- 4 Flares ×