Created
February 17, 2011 17:15
-
-
Save dawsontoth/832158 to your computer and use it in GitHub Desktop.
How to send emails in Appcelerator Titanium using activities and intents.
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: '#fff' }); | |
var button = Ti.UI.createButton({ title: 'Share' }); | |
win.add(button); | |
win.open(); | |
button.addEventListener('click', function() { | |
var intent = Ti.Android.createIntent({ | |
action: Ti.Android.ACTION_SEND, | |
type: 'text/plain' | |
}); | |
intent.putExtra(Ti.Android.EXTRA_SUBJECT, 'My subject!'); | |
intent.putExtra(Ti.Android.EXTRA_TEXT, 'My text!'); | |
try { | |
Ti.Android.currentActivity.startActivity(intent); | |
} catch (ex) { | |
/* Handle Exception if no suitable apps installed */ | |
Ti.UI.createNotification({ message : 'No sharing apps installed!' }).show(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the solution