Creating application for Android OS on Titanum Appcelerator platform


First, let's get a general item of information about Titanium Appceleratorplatform.

Apart from desktop apps, Titanium Appcelerator allows to write applications for mobile phones. Accordingly, the mentioned kind of application development gets split into 2 big parts: Titanium Desktop and Titanium Mobile.

We have a possibility to write applications for cellphones with such OS as Android, Blackberry, IPhone. There's no doubt with such a choice operation systems one can  write applications for, make you impressed. In the article below we'll talk about the process of writing application for OS Android.

In order to write a program for Android, any developer will require the knowledge of JavaScript. The program consists of objects that are inserted into it. Each object will have its unique features and will get its own methods employed. A list of objects gives us possibility to use practically all OS  resources.

Titanium Appcelerator  platform speeds up application development for Android because it's going to be longer to write program with Java than to write program on Titanium with the help of JavaScript. But programs written on Java will work faster. But here one of eternal questions of choosing program language arises: performance or expenses.

For you to write a simple application you need to know some objects of  Titanium. UI section. The most common objects are the following:

  • Titanium.UI.Button
  • Titanium.UI.ImageView
  • Titanium.UI.Label
  • Titanium.UI.ScrollableView
  • Titanium.UI.View
  • Titanium.UI.Window

Now let's look closer at the objects:

First of all it's necessary to clarify all rules of program writing.  One of the important aspects of program writing is correct object position. Every object has its value and property.

One of the main objects is Titanium.UI.Window. Creation of object happens with the help ofTitanium.UI.createWindowmethod. An object has a list of its features and methods. Having this long list of features we can set a background color, write its title, place it in the necessary spot (left, right, top, bottom) etc. We also shouldn't forget about methods such as open , add and some other methods.


var window = Titanium.UI.createWindow({
   title: 'My Root Window'

One of the frequently used objects is Titanium.UI.ScrollableViewScrollableView is so called container with a scroll. In other words other objects are put into the object, and if there is not enough space on the csreen, we can enable scroll to ScrollableView. You can create an object with the hekp of Titanium.UI.createScrollView method. There are also specific methods and objects.

Example shows the output of other objects with the help of ScrollableView.

var view1 = Titanium.UI.createView({backgroundColor:'red'}); 
var view2 = Titanium.UI.createView({backgroundColor:'green'});
var view3 = Titanium.UI.createView({backgroundColor:'yellow'});
var scrollView = Titanium.UI.createScrollableView({
ScrollableView content was specified during object creation. But other objects in ScrollableView can also be created with the help of add method.
In our case instead of specifying content in object, we can write:
which will be correct

It is for placing objects into the program that Titanium.UI.View element is characteristzed for. Simply saying View element provides us with a so called container, or something like div tag. In the container we can edit the view of other elements that are contained there. Some of the most necessary features of View are size and position features, and also View border features and its background color.

Next example shows us how to create View object:

var button = Titanium.UI.createButton({
   title: 'Hello'
{"You clicked the button"); 

Titanium.UI.ImageView is an element for image output. Image itself can be set in image properties. Image url or full path from file where program is written can be set in properties. It's also advisable to give exact size.

To create ImageView object, it's enough to write the following script:

var image = Titanium.UI.createImageView({
If we want to add image from internet, it's enough to specify in properties url instead of image 
It will look the following way:
   url: ''

So how will a program do without the most simple element Titanium.UI.Label? The element is for text output. Among other properties there are such as font size, text style, its color. We shouldn't forget that html text can be written for phones with OS Android. Using html bigger opportunities for text display are opening before us.


In this article we got acquainted with peculiarities of Titanium Appcelerator platform. We also found out characteristics of programming in Titanium Mobile and examined some widely used objects of Titanium.UI group. 

1 vote, Rating: 5

Read also


In the previous article we shared about creating install profiles for Drupal 6. In this article it'll be described how...


In Drupal 7 API there is a chapter dedicated to site theming. All elements of site, without exclusion, should go through the theming process. But first of all theming itself should be set up....


In this post the bases of creating environment for Drupal projects development on the basis of Debian 6 "Squeeze" will be described. Having this, everyone will be able to practice setting OS...


Being involved in development process one has got to realize actions/commands for which he has not been granted enough rights or the user whose server has launched and executed Drupal, is lacking...


One of Drupal 7's major advantages over its precursors is its flexibility with settings and systems. Drupal...

Need a quote? Let's discuss the project

Are you looking for someone to help you with your Drupal Web Development needs? Let’s get in touch and discuss the requirements of your project. We would love to hear from you.

Join to peoples who already subscribe