Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9263] Android: UI.Clipboard - setData, hasData and getData have no effect

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-05-29T19:45:49.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sRelease 2.1.0, Sprint 2012-11 API
ComponentsAndroid
Labelsapi, module_clipboard, qe-testadded
ReporterPaul Dowsett
AssigneeHieu Pham
Created2012-05-24T14:41:47.000+0000
Updated2013-11-06T19:05:23.000+0000

Description

Problem

The setData, hasData and getData methods of [Titanium.UI.Clipboard](http://docs.appcelerator.com/titanium/2.0/index.html#!/api/Titanium.UI.Clipboard) do not have any effect. This is mostly because setData's source code only converts the input to string but does not save it. Also, has data should return a boolean, but does not. See the test case below, and the source at [ClipboardModule.java](https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/clipboard/ClipboardModule.java).

Test case

Ti.UI.setBackgroundColor('#000');
Ti.UI.Clipboard.setData('text/plain', 'hello'); // does not store data
Ti.API.log('Does the Clipboard contain any data?...' + Ti.UI.Clipboard.hasData('text/plain')); // does not output boolean
Ti.API.log('Getting hello text from Clipboard...' + Ti.UI.Clipboard.getData('text/plain')); // does not generate any output
Ti.API.log('getText: ' + Ti.UI.Clipboard.getText()); // should this return data stored with setData where a mime type with a text prefix is specified?

Logs

No errors are generated.

Comments

  1. Paul Dowsett 2012-05-29

    APIDOC fixed in https://github.com/appcelerator/titanium_mobile/pull/2269
  2. Satyam Sekhri 2012-06-04

    The clipboard methods setData, hasData, hasText, getData and getText returning appropriate values. Verified on: Titanium Studio: 2.1.0.201206010843 Titanium SDK: 2.1.0.v20120604151821 Android Emulator 2.2 Runtime: v8
  3. Shameer Jan 2013-11-06

    Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4731

JSON Source