I have the following pieace of code:
ClipboardManager clipboardManager = (ClipboardManager)getContext().getSystemService(Context.CLIPBOARD_SERVICE);
ClipDescription clipDescription = new ClipDescription("some_description", new String[]{ClipDescription.MIMETYPE_TEXT_PLAIN});
ClipData.Item item1 = new ClipData.Item(editText1.getText().toString());
ClipData.Item item2 = new ClipData.Item(editText2.getText().toString());
ClipData clipData = new ClipData(clipDescription, item1);
clipData.addItem(item2);
clipboardManager.setPrimaryClip(clipData);
Log.d("CLIPBOARD", clipboardManager.getPrimaryClip().toString());
Which prints the following to the console:
ClipData { text/plain "some_description" <10-17 15:35:27.967> {T:editText1_content} {T:editText2_content} }
So it works fine at the first glance, but the copied strings won't show up on they clipboard of the virtual keyboard. (I use the Samsung Keyboard app.)
If I comment out the clipData.addItem(item2); part, I can see the first item on the clipboard. If I uncomment it, I can see neither of them.
What could be the problem?