This file contains 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 intent = Ti.Android.createIntent({ | |
action: Ti.Android.ACTION_VIEW, | |
data: 'http://www.cnblogs.com', | |
className: 'com.android.browser.BrowserActivity', | |
packageName: 'com.android.browser' | |
}); | |
Ti.Android.currentActivity.startActivity(intent); |
This file contains 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
function batchInserts(numRecords, useTransaction) { | |
var db = Ti.Database.open('database.sql'); | |
// Create Table | |
db.execute('DROP TABLE IF EXISTS test'); | |
db.execute('CREATE TABLE IF NOT EXISTS test(id INTEGER PRIMARY KEY, name TEXT);'); | |
var start = (new Date()).getTime(); | |
if (useTransaction) { |
This file contains 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(); | |
var images = [ | |
'images/home.png', | |
'images/cloud.png', | |
'images/cart.png' | |
]; | |
// Create an ImageView. | |
var anImageView = Ti.UI.createImageView({ |
This file contains 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 tg = Ti.UI.createTabGroup(); | |
var btn = Ti.UI.createButton({height: 40, title: 'Open new Window'}); | |
var w1 = Ti.UI.createWindow({backgroundColor: 'white'}); | |
w1.add(btn); | |
var t1 = Ti.UI.createTab({title: 'Tab', window: w1}); | |
tg.addTab(t1); | |
tg.open(); |
This file contains 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 tg = Ti.UI.createTabGroup(); | |
var win1 = Ti.UI.createWindow({backgroundColor: 'white'}); | |
var t1 = Ti.UI.createTab({title: 'Tab 1', window: win1}); | |
var win2 = Ti.UI.createWindow({backgroundColor: 'red'}); | |
var t2 = Ti.UI.createTab({title: 'Tab 2', window: win2}); | |
var win3 = Ti.UI.createWindow({backgroundColor: 'blue'}); | |
var t3 = Ti.UI.createTab({title: 'Tab 3', window: win3}); |
This file contains 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 vsearchbar = Ti.UI.createSearchBar({top: 0, height: 40, hintText: 'Search', showCancel: true}); | |
win.add(vsearchbar); | |
var searchbar = Ti.UI.createSearchBar(); | |
var tbl = Ti.UI.createTableView({ | |
search: searchbar, | |
visible: false, | |
}); | |
tbl.setData( fetchData(0, 5) ); |
This file contains 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.Media.openPhotoGallery({ | |
success : function(event) { | |
// TODO: 2 WAYS TO GET WIDTH/HEIGHT OF EVENT.MEDIA | |
// 1. STORE IT TO FILE THEN GET W/H | |
// 2. event.cropRect.width/height | |
var cropRect = event.cropRect; | |
var filename = (new Date().getTime()) + "_tmp.png"; |
This file contains 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 service = Titanium.App.iOS.registerBackgroundService({ | |
url: 'bgservice.js' | |
}); |
This file contains 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(); | |
var overlay = Ti.UI.createWebView({ | |
url: 'html/index.html', | |
opacity: 0.5, | |
backgroundColor: 'white', | |
zIndex: 1 | |
}); | |
var btn = Ti.UI.createButton({ |
This file contains 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
/** | |
* yearRange: {min: 2000, max: 2012}, | |
* monthRange: {min:1, max: 12} | |
*/ | |
function monthYearPicker(yearRange, monthRange) { | |
var picker = Ti.UI.createPicker(); | |
var yCol = Ti.UI.createPickerColumn(); | |
for(var i = yearRange.min; i <= yearRange.max; i++) { | |
yCol.addRow(Ti.UI.createPickerRow({ |