I want to implement the cut,copy, paste functionality in my EditText,i tried with the following code :
ClipMan = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
editbox1.setText(ClipMan.getText());
for paste the text,but it paste the whole text in another Editbox..I want to copy the selected text and paste that text in the same Editbox just like the normal notepad works..
Any suggestions are greatly appreciated... Thanks !!
for copy data
ClipData clip = ClipData.newPlainText("simple text",Value);
ClipMan.setPrimaryClip(clip);
and get data which was copied
CharSequence pasteData="";
ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0);
pasteData = item.getText();
in your case you can use EditText.getText()
instead of Value
..
and EditText.setText(pasteData);
for paste that data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With