-1

enter image description here

I want to copy these text and past into other apps like WhatsApp twitter etc to the clipboard by clicking this (copy tag button) how can I do here is my activity

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

1 Answers1

0

You can copy something to clipboard using something like this:

ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("some label", floatingTextButton.getText().toString()); clipboard.setPrimaryClip(clip);

Clapa Lucian
  • 590
  • 2
  • 7
  • 14
  • While this code snippet may solve the question, [including an explanation](http://meta.stackexchange.com/questions/114762/explaining-entirely-‌​code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. – Rosário Pereira Fernandes Feb 17 '18 at 16:09
  • .getText().toString()); did not use in android s3 – MANSOOR KHAN Mar 13 '18 at 06:32