I know this question is already been asked but still, it does not help me to resolve issue
I am getting issue while copy data to clipboard-manager
below is code
fun copyToClipboard(context: Context, text: CharSequence){
var clipboard: ClipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
var clip: ClipData = ClipData.newPlainText("label",text)
clipboard.primaryClip = clip!!
}
as @ianhanniballake suggested, I have already use use setPrimaryClip() with a non-null ClipData
like below
var clip: ClipData = ClipData.newPlainText("label",text)
clipboard.primaryClip = clip!!
But don't know why, still I am getting same error like
Val cannot be reassigned