emulates the behavior of the now-deprecated android.text.clipboardmanager #gettext by invoking android.content.clipdata.item #coercetotext context on the firstitem in the clipboard if any and returning the result as a string . this is quite different than simply calling object #tostring onthe clip ; consumers of this api should familiarize themselves with the process described in android.content.clipdata.item #coercetotext context before usingthis method . concode_field_sep Context mContext concode_elem_sep ClipboardManager mClipboardManager concode_field_sep Clipboard create concode_elem_sep boolean hasPlainText concode_elem_sep void setText
String function ( ) { final ClipData loc0 = mClipboardManager . getPrimaryClip ( ) ; if ( loc0 != null && loc0 . getItemCount ( ) > 0 ) { final CharSequence loc1 = loc0 . getItemAt ( 0 ) . coerceToText ( mContext ) ; if ( loc1 != null ) { return loc1 . toString ( ) ; } } return null ; }