Skip to content

Instantly share code, notes, and snippets.

@sbhimavarapuAppc
sbhimavarapuAppc / file.js
Created October 13, 2011 00:02
Write to an external file Android
var win = Ti.UI.createWindow({backgroundColor: 'white'});
var dir = Titanium.Filesystem.getFile(Titanium.Filesystem.externalStorageDirectory);
Ti.API.info(dir.nativePath);
var testfile = Ti.Filesystem.getFile(dir.nativePath, 'text.txt');
testfile.write('Hello');
Ti.API.info('external directoryListing = ' + dir.getParent().getDirectoryListing());
Ti.API.info('text.txt exists? ' + testfile.exists());
Ti.API.info('text.txt size: ' + testfile.size + ' bytes');
@sbhimavarapuAppc
sbhimavarapuAppc / app.js
Created September 29, 2011 18:47
Custom fonts in Webview - Android
// Make sure you have your custom font-file under Resources/fonts
var webview = Ti.UI.createWebView({
url: 'local_webview.html'
});
var window = Ti.UI.createWindow();
window.add(webview);
@sbhimavarapuAppc
sbhimavarapuAppc / customrows.js
Created September 28, 2011 18:11
BB Custom Rows
// Thanks to Jon Alter for the idea
var win = Ti.UI.currentWindow;
var data = [];
for (var i = 0; i < 10; i++) {
data.push({title:'I am row text '+i, leftImage:'../images/user.png', header: 'Yes'});
}
for (var i = 0; i < 10; i++) {
@sbhimavarapuAppc
sbhimavarapuAppc / searchBar.js
Created September 27, 2011 17:57
SearchBar to search over a table - Not included as a table searchBar
var isSearchPresent = false;
var data = [
{title:'A - Server 1', header:'Servers'},
{title:'B - Server 2'},
{title:'C - Server 3'},
{title:'A - WorkStation 1', header:'WorkStations'},
{title:'B - WorkStation 2'},
{title:'C - WorkStation 3'},
{title:'D - WorkStation 4'},
@sbhimavarapuAppc
sbhimavarapuAppc / cameraOverlay.js
Created September 26, 2011 20:50
Custom Camera Overlay
var win = Titanium.UI.currentWindow;
var messageView = Titanium.UI.createView({
height:30,
width:250,
visible:false
});
var indView = Titanium.UI.createView({
height:30,