Skip to content

Instantly share code, notes, and snippets.

@Barneybook
Barneybook / app.js
Created September 7, 2012 15:17
Titanium Tip
//Titanium.App.exit for Android
//Use finish() method for current activity:
var activity = Titanium.Android.currentActivity;
activity.finish();
//Works for 1.5+: http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Android.Activity-object.html
Ti.API.info(JSON.stringify(someObject));
[ERROR][WindowManager( 1048)] Activity org.appcelerator.titanium.TiModalActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40cb3818 that was originally added here
[ERROR][WindowManager( 1048)] android.view.WindowLeaked: Activity org.appcelerator.titanium.TiModalActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40cb3818 that was originally added here
[ERROR][WindowManager( 1048)] at android.view.ViewRoot.<init>(ViewRoot.java:258)
[ERROR][WindowManager( 1048)] at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
[ERROR][WindowManager( 1048)] at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
[ERROR][WindowManager( 1048)] at android.view.Window$LocalWindowManager.addView(Window.java:424)
[ERROR][WindowManager( 1048)] at android.app.Dialog.show(Dialog.java:241)
[ERROR][WindowManager( 1048)] at ti.modules.titanium.ui.widget.TiUIActivityIndicator.handleShow(TiUIActivityIndicator.java:228)
[ERROR][WindowManager( 1
@Barneybook
Barneybook / app.js
Created October 11, 2012 13:05
record Audio using Titanium Framework
var win = Titanium.UI.createWindow({
title: 'Video Recording from Appcelerator Titanium',
backgroundColor: '#fff'
});
// const value grabbed from
// http://developer.android.com/reference/android/provider/MediaStore.Audio.Media.html#RECORD_SOUND_ACTION
var RECORD_SOUND_ACTION = "android.provider.MediaStore.RECORD_SOUND";
var soundUri = null; // Will be set as a result of recording action.
@Barneybook
Barneybook / app.js
Created October 11, 2012 15:09
try this for video recording
//http://developer.appcelerator.com/question/49321/can-we-record-video-using-titanium
var win = Titanium.UI.createWindow({
title: 'Video Recording from Appcelerator Titanium',
backgroundColor: '#fff'
});
var recordButton = Titanium.UI.createButton({
top: 10, left: 10, right: 10, height: 35, title: 'Record Video'
});
win.add(recordButton);
@Barneybook
Barneybook / gist:3915973
Created October 19, 2012 02:53
IOS6 update in Titanium
iPhone 5 Assets and Splash Screens
For best results, existing applications should be updated with assets to fit the new iPhone 5 screen (1136 x 640 pixels) as needed.
Assets specific to the new screen should be named with the suffix -568h@2x.
For example, the default splash screen image for the new screen is named Resources/iphone/Default-568h@2x.png.
@Barneybook
Barneybook / app.js
Created November 7, 2012 04:32
Titanium Tip 01 url
var casheBuster = new Date();
var view[i] = Titanium.UI.createImageView({ image:'image/'+image+'.jpg?casheBuster='+casheBuster.getTime() });
@Barneybook
Barneybook / exp.php
Created December 1, 2012 06:27
CI PHP
$this->config->base_url();
@Barneybook
Barneybook / test.as
Created December 26, 2012 09:04 — forked from anonymous/test.as
private function getUniqueName () : String
{
var d : Date = new Date();
return d.getMonth() + 1 + '' + d.getDate() + '' + d.getHours() + '' + d.getMinutes() + '' + d.getMilliseconds();
}
於AS3中呼叫JS函數並傳遞參數方法 ExternalInterface.call( );
1、AS3部分,Code範例為按鈕事件觸發後呼叫JS函數jstest
var $jsvalue="test"; //宣告變數$jsvalue,變數值為test
this.addEventListener(MouseEvent.CLICK,clicktrue); //按鈕偵聽器
function clicktrue(me:MouseEvent){
ExternalInterface.call("jstest",$jsvalue); //jstest為欲呼叫之JS函數,$jsvalue為AS3欲傳遞到JS的參數值。
}