O'Reilly logo

Appcelerator Titanium Smartphone App Development Cookbook - Second Edition by Jason Kneen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Storing and retrieving data via the clipboard

The clipboard is used to store textual and object data so that it can be utilized between different screens and applications on your device. While both iOS and Android have a 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 to another.

How to do it…

  1. Open your project's app.js file and enter the following text (deleting any existing code). Once you are done, run your application on the simulator to test it:
    var win1 = Ti.UI.createWindow({ backgroundColor : '#fff', title ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required