The clipboard is used to store textual and object data so it can be utilized between different screens and applications on your device. While both iOS and Android have built-in clipboard capability, Titanium extends this by letting you programmatically access and write data to the clipboard. In this recipe, we will create a screen with two text fields and a series of buttons that allow us to programmatically copy data from one text field and paste it into another.
Open your project's app.js
file in your IDE and enter in the following code (deleting any existing code). When finished, run your application in the emulator to test it.
var win1 = Titanium.UI.createWindow({ backgroundColor: '#fff', title: 'Copy and Paste' }); var txtData1 = Titanium.UI.createTextField({ left: 20, width: 280, height: 40, top: 10, borderStyle:Titanium.UI...