Why show java.lang.ClassCastException: android.text.SpannableString cannot be cast to java.lang.String?
问题 When copying String from any browser page, pasteData works properly. However when copying SpannedString from a message sent item editor(field), the application crashes and shows this error message: java.lang.ClassCastException: android.text.SpannableString cannot be cast to java.lang.String My code: // since the clipboard contains plain text. ClipData.Item item = clipBoard.getPrimaryClip().getItemAt(0); // Gets the clipboard as text. String pasteData = new String(); pasteData = (String) item