Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

android copy text to clipboard programmatically

import android.content.ClipboardManager;

// ...

ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); 
ClipData clip = ClipData.newPlainText("label", "Text to copy");
clipboard.setPrimaryClip(clip);
Comment

copy to clipboard android studio

ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); 
 ClipData clip = ClipData.newPlainText(label, text);
 clipboard.setPrimaryClip(clip);
Comment

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()
            
Comment

PREVIOUS NEXT
Code Example
Java :: rgb to hex java 
Java :: java save file dialog 
Java :: regex java email validation 
Java :: dexter dependency 
Java :: java random number 
Java :: how to loop through code 3 times java 
Java :: java integer to binary string with leading zeros 
Java :: textview set drawable right programmatically 
Java :: java lambda foreach multiple statements 
Java :: java convert bytes to string 
Java :: JFrame Exit oon close Java20 
Java :: center justify jlabel 
Java :: java get mouse coordinates 
Java :: datentypen java 
Java :: java create a set with values 
Java :: array to map java3 
Java :: set height of layout programmatically android 
Java :: java add commas to numbers 
Java :: add label gui jframe 
Java :: finding absolute value in java 
Java :: how to take space separated input in java 
Java :: ova definition 
Java :: read a file in java and store as integer array using buffered reader 
Java :: duck number in java 
Java :: java contains password input 
Java :: java string to int 
Java :: arraylist with values 
Java :: java int to hex fixed length 
Java :: method to check parameters in java 
Java :: xAxis.setTextSize() text gets clipped 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =