Android: Copy to clipboard selected text from a TextView
问题 Is there a possibility to copy to clipboard from a TextView UI component only the selected text? I've catched the long press event and I copied the full text to clipboard, but now I want to specify the start and the end of the selection to be copied from a TextView. Thank you. 回答1: TextView tv; String stringYouExtracted = tv.getText().toString(); int startIndex = tv.getSelectionStart(); int endIndex = tv.getSelectionEnd(); stringYouExtracted = stringYouExtracted.subString(startIndex, endIndex