Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Counter shows an alert when it reaches 10.
var win = Ti.UI.createWindow({backgroundColor:'white'});
var count = 0;
var label = Ti.UI.createLabel({text:'Counter: 0', top:50, font:{fontSize:24}});
var incButton = Ti.UI.createButton({title:'+', top:100});
var resetButton = Ti.UI.createButton({title:'Reset', top:150});
incButton.addEventListener('click', function(){
count++;
label.text='Counter: ' + count;
if(count===10){
Ti.UI.createAlertDialog({title:'Alert', message:'Count reached 10!'}).show();
}
});
resetButton.addEventListener('click', function(){
count=0;
label.text='Counter: ' + count;
});
win.add(label);
win.add(incButton);
win.add(resetButton);
win.open();Titanium Appcelerator is an open-source mobile development framework that allows developers to build native iOS and Android apps using JavaScript, providing a single codebase for multiple platforms.
Origin & Creator
Created by Appcelerator, Inc. in 2008 to simplify cross-platform native mobile development using JavaScript.
Industrial Note
Titanium is widely used in enterprise mobile applications where native performance and device API access are required, particularly in banking, healthcare, and logistics apps.