2011年3月25日 星期五

[Resources] Copy and Paste

* The clip object (ClipData.Item) can take one of three forms:
  1. Text
  2. URI
  3. Intent

* The clipboard holds only one clip object at a time. When an application puts a clip object on the clipboard, the previous clip object disappears.

* To add data to the clipboard, you create a ClipData object that contains
  1. A description of the data: A ClipDescription object.
  2. The data itself: One or more ClipData.Item objects.

* A ClipDescription object
- Contains an array of available MIME types for the clip's data: when you put a clip on the clipboard, this array is available to pasting applications, which can examine it to see if they can handle any of available the MIME types.

* To copy data
  1. An application puts a ClipData object on the ClipboardManager global clipboard.
  2. The ClipData contains one or more ClipData.Item objects and one ClipDescription object.

* To paste data
  1. An application gets the ClipData, gets its MIME type from the ClipDescription
  2. And gets the data either from the ClipData.Item or from the content provider referred to by ClipData.Item.

* You should verify that the clipboard contains a clip and that you can handle the type of data represented by the clip.


* Reference
- Copy and Paste

沒有留言:

張貼留言