Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

copy text in android button clipboard

import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context

// ...

val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText("ussd_code", ussdCode)
clipboard.setPrimaryClip(clip)
Toast.makeText(activity, "Copied", Toast.LENGTH_LONG).show()
            
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #copy #text #android #button #clipboard
ADD COMMENT
Topic
Name
7+7 =