Skip to content Skip to sidebar Skip to footer

How Can I Copy Section Of Textview Not All Of That In This Code?

I have this code from Mr Naddy for copying textView to clipboard in API 7 TextView textView=(TextView)findViewById(R.id.textView1); registerForContextMenu(textView); Then override

Solution 1:

have you tried this ?

TextView tv;
StringstringYouExtracted= tv.getText().toString;
intstartIndex= tv.getSelectionStart();
intendIndex= tv.getSelectionEnd();
stringYouExtracted = stringYouExtracted.subString(startIndex, endIndex);
ClipboardManagerclipboard= (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
clipboard.setText(stringYouExtracted);

found at: Android: Copy to clipboard selected text from a TextView

Post a Comment for "How Can I Copy Section Of Textview Not All Of That In This Code?"