Button to copy the value of a string to the clipboard

后端 未结 2 445
别跟我提以往
别跟我提以往 2021-02-09 15:01

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

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-09 15:15

    provide a context before

    getSystemService(Context.CLIPBOARD_SERVICE);
    

    like

    Context context = ...;
    ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
    

提交回复
热议问题