클립보드 Clipboard

2022. 12. 27. 13:02개발자료/Android


반응형

@

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
	final android.content.ClipboardManager cm;
    final android.content.ClipData clipData;
    cm = (android.content.ClipboardManager)context.getSystemService(Context.CLIPBOARD_SERVICE);
	clipData = android.content.ClipData.newPlainText("text label", "클립보드에 저장되는 값");
	cm.setPrimaryClip(clipData);
} else {
	final android.text.ClipboardManager cm;
    cm = (android.text.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
	cm.setText("클립보드에 저장되는 값");
}

 

반응형