I\'m modifying an old Android application. I have a GPS lat and long being stored in a string value and displayed to the user in a non-editable text box when it resolves. I wa
If it is just Text, it is very simple.
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("label","Your Text");
clipboard.setPrimaryClip(clip);
For further Information check out this link
provide a context before
getSystemService(Context.CLIPBOARD_SERVICE);
like
Context context = ...;
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);