Question Detail

How to Copy Text to Clip Board in Android?

6 years ago Views 1387 Visit Post Reply

Clipboard is for the most part used to copy information from an feild to a brief area and Paste the information from the impermanent area to an area.
I want to copy Text in Clipboard on button click how can i do this in andorid.Android using Clipboard to Copy and Paste data in Android Application project.

Thread Reply


- 6 years ago

findViewById( View.OnClickListener() {
            public void onClick(View view) {
                android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
                android.content.ClipData clip = android.content.ClipData.newPlainText("Copied Text", "<Your Text>");

replace <Your Text> with the text you want to copy to clipboard