import android.content.ClipboardManager;
.
.
.
ClipboardManager clipboardManager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData clipData = ClipData.newPlainText("label", "Text that needs to be copied");
clipboardManager.setPrimaryClip(clipData); |
import android.content.ClipboardManager;
.
.
.
ClipboardManager clipboardManager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData clipData = ClipData.newPlainText("label", "Text that needs to be copied");
clipboardManager.setPrimaryClip(clipData);