public static void setClipboardText ( final Context context , final String text ) { if ( text != null ) { final ClipboardManager clipboard = ( ClipboardManager ) context . getSystemService ( Context . CLIPBOARD_SERVICE ) ; final ClipData clipData = ClipData . newPlainText ( text , text ) ; clipboard . setPrimaryClip ( clipData ) ; } }
Set the clipboard text .