ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText(myText);
clipboard.setPrimaryClip(clip);
上面的代码有时会抛出如下异常:
Exception: android.os.TransactionTooLargeException: data parcel size 1284248 bytes
Stack trace: java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 1284248 bytes
at android.content.ClipboardManager.setPrimaryClip(ClipboardManager.java:106)
etPrimaryClip() 或 ClipData 是否有大小限制?