Skip to content

Instantly share code, notes, and snippets.

@juniorcesarabreu
Created December 22, 2019 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juniorcesarabreu/95705cfacb6038c482acc11ab5662c1e to your computer and use it in GitHub Desktop.
Save juniorcesarabreu/95705cfacb6038c482acc11ab5662c1e to your computer and use it in GitHub Desktop.
// Gets a handle to the clipboard service.
ClipboardManager clipboard = (ClipboardManager)
getSystemService(Context.CLIPBOARD_SERVICE);
// Creates a new text clip to put on the clipboard
ClipData clip = ClipData.newPlainText("Área", textViewArea.getText());
// Set the clipboard's primary clip.
if (clipboard != null) {
clipboard.setPrimaryClip(clip);
}
Toast.makeText(PlantaBaixaActivity.this, "Valor da Área copiado.", Toast.LENGTH_SHORT).show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment