Created
August 26, 2011 15:39
-
-
Save appcdr/1173690 to your computer and use it in GitHub Desktop.
Appcelerator: Android Send Intent sample app
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
Ti.UI.backgroundColor = '#000000'; | |
var win = Ti.UI.createWindow(); | |
var label = Ti.UI.createLabel({ | |
text: 'Say Something!', | |
color:'#eeeeee', | |
font: { | |
fontSize:'20dp', | |
fontWeight:'bold' | |
}, | |
height:'auto', | |
top:'5dp' | |
}); | |
var textarea = Ti.UI.createTextArea({ | |
width:'90%', | |
top:'44dp', | |
bottom: '70dp', | |
left:10, | |
right:10 | |
}); | |
var button = Ti.UI.createButton({ | |
title:'Share', | |
height:'auto', | |
width:'auto', | |
font: { | |
fontSize:'24dp' | |
}, | |
bottom:'10dp', | |
right:10 | |
}); | |
button.addEventListener('click', function(e) { | |
var intent = Ti.Android.createIntent({ | |
action: Ti.Android.ACTION_SEND, | |
type: "text/plain" | |
}); | |
intent.putExtra(Ti.Android.EXTRA_TEXT, textarea.value); | |
intent.addCategory(Ti.Android.CATEGORY_DEFAULT); | |
Ti.Android.currentActivity.startActivity(intent); | |
}); | |
win.add(label); | |
win.add(textarea); | |
win.add(button); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment