Specification: You will share data with other apps using intents. Then you will implement the Android-specific method to hide the soft keyboard.
Create a new mobile application project in AppceleratorStudioDownload the starting code from this link and import it into Appcelerator Studio.
Inside the index controller, there is a listener for when the send button is clicked. First we want to use Ti.UI.Android.hideSoftKeyboard() to hide the keyboard.
Now create a variable called intent and use Ti.Android.createIntent() to create the intent we will use. The intent will have an action property that will be Ti.Android.ACTION_SEND, and a type that is ‘text/plain’.
Next we want to put the information the user typed in the boxes into our intent. This is done by calling putExtra() on the intent. The extras will be EXTRA_SUBJECT , and EXTRA_TEXT, and EXTRA_EMAIL. put Put the relevant input from the user into these extras
Pass the intent to the function Ti.Android.currentActivity.startActivity(), and surround that with a try catch block.
If an exception is thrown show an alert notifying the user that there are no sharing apps available to use.
Compile and run your app on an Android emulator or device. It is preferable to test this on a real device because the emulator might not have compatible sharing apps installed. Now after pressing the send button, you will be able to send an email a message using your preferred email app.
Image RemovedImage RemovedImage AddedImage Added
You can download the completed application from: this link.