Skip to content

Instantly share code, notes, and snippets.

@dawsontoth
Created April 29, 2011 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dawsontoth/370939b6e54dadf6f5a9 to your computer and use it in GitHub Desktop.
Save dawsontoth/370939b6e54dadf6f5a9 to your computer and use it in GitHub Desktop.
"Sharing" test case in Appcelerator Titanium for Android
var win = Ti.UI.createWindow({ navBarHidden: true, layout: 'vertical' });
win.add(Ti.UI.createLabel({ text: '1. Leave this app and "Share" some text.', top: 20 }));
var button = Ti.UI.createButton({ title: '2. Touch me to crash the application.', top: 20 });
button.addEventListener('click', function() {
Ti.UI.createActivityIndicator({
message: '3. This alert should crash the app.'
}).show();
});
win.add(button);
win.open();
Ti.Android.currentActivity.finish();
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
<id>com.dawson.playgroundmobile</id>
...
<android xmlns:android="http://schemas.android.com/apk/res/android">
<activities>
<activity url="shareActivity.js">
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
</intent-filter>
</activity>
</activities>
</android>
</ti:app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment