Skip to content

Instantly share code, notes, and snippets.

Titanium.UI.setBackgroundColor('#000');
// Create a window
var win = Titanium.UI.createWindow({
title:'Web Test',
backgroundColor:'#fff'
});
// and now a webView
var webview1 = Titanium.UI.createWebView({url:'somePage.html'});
var updatePeriod = 5 * 60 * 1000; //mins * seconds * 1000
var locationUpdateEnabled = false;
// This gets fired when the webView has loaded.
// Rather than using the generic event of the webview
// - it's more reliable to create your own and have the page itself trigger when it's ready
// - This allows your code to initialise things properly before asking for update
Ti.App..addEventListener('pageReadyForUpdates', function(e) {
// This will only get fired once and when the page itself is ready to start receiving update
// Create the xhr object
var xhr = Titanium.Network.createHTTPClient();
// Set the static properties on the xhr object
xhr.setTimeout(20000);
// Helper for updating the interface
function networkUpdateSuccess() {
alert('Success Uploaded',Ti.App.globalImage);
Module developer creates a module
They wish to create a single module but have enhanced API functionality for 2.1+ because they depend on some API features only available on that platform. The API they are using also may have changed between platform versions (think Android contacts).
For users of the 1.6 module - they will have reduced functionality but broader reach.
Option (1)
They release 2 differently named modules and the module consumer has to download/buy both
Option (2)
Use a folder structure for modules that differentiate based on platform.
var win = Titanium.UI.currentWindow;
var xhr;
Ti.App.globalImage = null;
function alert(title,message){
var alertDialog = Titanium.UI.createAlertDialog({
title: title,
message: message,
buttonNames: ['OK']
/**
* Menu
**/
/**
* initMenu(); - Clears & inits the menu object
* addMenuItem(MenuItem); - Which we pass a menuItem which is then added to an array of menu items
* buildMenu(); - which sets the menu (use from the calling window)
*/
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
package ti.modules.titanium.ui.widget;
public class TiUIText extends TiUIView
implements TextWatcher, OnEditorActionListener, OnFocusChangeListener
/**
* You don't need to specify this directly, a module definition class is generated for you as part of the build process for your module
*
*/
@Ti.module(
name = "UrbanAirships",
version = @version(buildVersion=0, minorVersion=0, majorVersion=1),
dependsUponTitanium = @version(minorVersion=3, majorVersion=1)
)
<path>1.3.3/titanium.py create
--platform=android
--type=module
--dir=<top most folder for the project>
--name=<projectName>
--android=<android SDK path >
--id=<the project class path ie: org.appcelerator.widget>
{% extends "APIMeteringBundle::layout" %}
{% block title %}Index{% endblock %}
{% block content %}
{% import "APIMeteringBundle::macros" as forms %}
{% autoescape off %}
{{ form.renderAs('Renderer\\TablelessRenderer') }}
{{ form.render }}
{{ form.renderFormTag(formURL)}}
Client Reference: {{ form.refID.render }}