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.
- 6 years ago
findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
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>");
clipboard.setPrimaryClip(clip);
}
});
replace <Your Text> with the text you want to copy to clipboard
Hot Questions