This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Use this script in one of several ways: | |
# To launch the Android package manager, ./t a | |
# To deploy to Android ./t /Code/PathToYourProject da | |
# To run the iOS Simulator ./t /Code/PathToYourProject si | |
# To run the Android Emulator ./t /Code/PathToYourProject sa | |
# Future feature: add support for deploying to iOS with the "di" flag | |
## | |
## |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow({ | |
backgroundColor: 'white' | |
}); | |
var tableView = Ti.UI.createTableView(); | |
var setupDB = function() { | |
var db = Ti.Database.open('mydb.db'); | |
db.execute('CREATE TABLE IF NOT EXISTS DATABASETEST (ID INTEGER, NAME TEXT)'); | |
db.execute('DELETE FROM DATABASETEST'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the following code is both the logic and examples of using it | |
var win = Titanium.UI.currentWindow; | |
// I've set anyDensity to true in my app and this function enables the UI to properly scale | |
// you can safely delete this function and all references to it if you'd like | |
var adj = function(pixels) { | |
if(Titanium.Platform.name == 'iPhone OS') { | |
return pixels; | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
## Command line interface for creating and building Titanium Mobile Android projects. | |
TI_SRC="$HOME/local/src/titanium_mobile" | |
TI_SDK="$TI_SRC/dist/mobilesdk/linux/1.7.0" | |
TI_VERSION_TAG="1_7_0_preview" | |
ANDROID_HOME=${ANDROID_HOME:-"$HOME/local/lib/android-sdk"} | |
JAVA_HOME=${JAVA_HOME:-"/usr/lib/jvm/java-6-sun"} #sun-java6-sdk | |
PROJECT_HOME="$HOME/projects/ti" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var activity = Ti.Android.currentActivity; | |
var win = Ti.UI.currentWindow; | |
activity.addEventListener("create", function(e) { | |
var button = Ti.UI.createButton({title: "Hello world"}); | |
button.addEventListener("click", function(e) { | |
activity.finish(); | |
}); | |
win.add(button); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
win.add(Ti.UI.createLabel({ text: 'Type appcelerator.com in a browser, and this app will get launched. Try it!' })); | |
win.open(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
win.add(Ti.UI.createLabel({ text: 'Look for the notification! It should be there now.' })); | |
win.open(); | |
Titanium.Android.NotificationManager.notify( | |
0, // <-- this is an ID that we can use to clear the notification later | |
Ti.Android.createNotification({ | |
contentTitle: 'Cheese, Gromit!', | |
contentText: 'Swiss', | |
tickerText: 'Our app made a notification!', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Titanium | |
Titanium.addEventListener | |
Titanium.fireEvent | |
Titanium.include | |
Titanium.removeEventListener | |
Titanium.userAgent | |
Titanium.version | |
Titanium.API | |
Titanium.API.addEventListener | |
Titanium.API.debug |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// in this demo, we simply show how you could dynamically scroll | |
// with a continuous amount of data in the tableview by detecting | |
// when the user's scroll position gets near the end of the table | |
// and start a background fetch of new data and seamlessly append | |
// the new data to the table automatically | |
// | |
var win = Ti.UI.createWindow(); |
NewerOlder