[Android]
[Android][Kotlin] 클립보드에 텍스트를 복사해보자!
민프야
2021. 10. 2. 12:49
// 텍스트를 클립보드에 복사하기
mBinding.AddressContainer.setOnClickListener {
Log.d(TAG + " AddressContainer", "클릭함")
val getText = mBinding.textView.text.toString()
Log.d(TAG+ " getText",getText)
val clipboard: ClipboardManager = getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
val clip: ClipData = ClipData.newPlainText("WalletAddress", getWalletAddress)
clipboard.setPrimaryClip(clip)
Toast.makeText(getApplicationContext(), "텍스트가 클립보드에 복사되었습니다.",Toast.LENGTH_SHORT).show()
}