Skip to content

Instantly share code, notes, and snippets.

@appcdr
appcdr / snip.js
Created August 29, 2011 16:32
Appcelerator: HTTPClient snippet
var url = "https://www.appcelerator.com";
var xhr = Ti.Network.createHTTPClient({
onload: function(e) {
// this.responseText holds the raw text return of the message (used for JSON)
// this.responseXML holds any returned XML (used for SOAP web services)
// this.responseData holds any returned binary data
Ti.API.debug(this.responseText);
alert('success');
},
onerror: function(e) {
@appcdr
appcdr / json.txt
Created August 29, 2011 15:52
Appcelerator: HTTPClient and JSON sample JSON
{
"fighters": [
{
"name": "Muhammad Ali",
"nickname": "The Greatest"
},
{
"name": "Chuck Liddell",
"nickname": "The Iceman"
},
@appcdr
appcdr / app.js
Created August 29, 2011 15:45
Appcelerator: HTTPClient and JSON sample app
Ti.UI.backgroundColor = '#dddddd';
var url = "https://raw.github.com/appcelerator/Documentation-Examples/master/HTTPClient/data/json.txt";
var win = Ti.UI.createWindow();
var table = Ti.UI.createTableView();
var tableData = [];
var json, fighters, fighter, i, row, nameLabel, nickLabel;
var xhr = Ti.Network.createHTTPClient({
onload: function() {
Ti.Android.currentActivity.startActivity(intent);
intent.addCategory(Ti.Android.CATEGORY_DEFAULT);
intent.putExtra(Ti.Android.EXTRA_TEXT, 'Some text that we want to share');
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_SEND,
type: "text/plain"
});
@appcdr
appcdr / app.js
Created August 26, 2011 15:39
Appcelerator: Android Send Intent sample app
Ti.UI.backgroundColor = '#000000';
var win = Ti.UI.createWindow();
var label = Ti.UI.createLabel({
text: 'Say Something!',
color:'#eeeeee',
font: {
fontSize:'20dp',
fontWeight:'bold'
},
@appcdr
appcdr / snippet.js
Created August 26, 2011 14:40
Android Send Text Intent
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_SEND,
type: "text/plain"
});
intent.putExtra(Ti.Android.EXTRA_TEXT, 'Some text that we want to share');
intent.addCategory(Ti.Android.CATEGORY_DEFAULT);
Ti.Android.currentActivity.startActivity(intent);
@appcdr
appcdr / AndroidManifest.xml
Created August 24, 2011 19:42
Appcelerator: Android Intent Filter AndroidManifest.xml
<!-- TI_APPLICATION -->
<activity android:name=".IntentFilterTestActivity"
android:label="Intent Filter Test" android:theme="@style/Theme.Titanium"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>