@ SuppressWarnings ( "deprecation" ) @ SuppressLint ( "NewApi" ) private void addLinkToClipBoard ( String url , String label ) { int sdk = android . os . Build . VERSION . SDK_INT ; if ( sdk < android . os . Build . VERSION_CODES . HONEYCOMB ) { android . text . ClipboardManager clipboard = ( android . text . ClipboardManager ) context_ . getSystemService ( Context . CLIPBOARD_SERVICE ) ; clipboard . setText ( url ) ; } else { android . content . ClipboardManager clipboard = ( android . content . ClipboardManager ) context_ . getSystemService ( Context . CLIPBOARD_SERVICE ) ; android . content . ClipData clip = android . content . ClipData . newPlainText ( label , url ) ; clipboard . setPrimaryClip ( clip ) ; } Toast . makeText ( context_ , builder_ . getUrlCopiedMessage ( ) , Toast . LENGTH_SHORT ) . show ( ) ; }
Adds a given link to the clip board .