Button to copy text to clipboard

Morning All!

I am developing an application for managing templates for notetaking. To be more specific, I have a list of text templates which I need to copy to the Android clipboard which then I can paste into another application. I want to be able to push a single button in order to copy the text to clipboard. I see there was some discussions previous on this but I dont see anything recent with a solution.

Hi @hogan029uga7, thanks for reaching out.

This would not be possible between two different apps–your OS already has the built-in copy and paste capabilities.

You could mimic this action in your Thunkable app by creating a temporary variable when the user “copies” the text and then set a text label to the variable to mimic “pasting” the text if you wanted to just do this in your app.

Thanks for your reply!
The issue is that I want to cut and paste these templates into the Microsoft OneNote Android application. I am using a “Label” field to display the information. I cannot however even use the manual android copy and paste… any ideas why that is happening or if im missing something?

Just the way the labels are set up, text cannot be copied or pasted from or into them. You could try using a text input and set it to not editable. You can hopefully copy and paste into that component.

Or you can use html code like this


<!DOCTYPE html>
<html>
<body>
<script>
var my_fav_food = "My fav food is pizza";
</script>

<button onclick="copying_function(my_fav_food)">My Fav Food</button>

<script>
function pasting_function(string) {
 // string.select();
  const el = document.createElement('textarea');
  el.value = string;
  document.body.appendChild(el);
  el.select();
  document.execCommand('copy');
  console.log("copyed!");
    document.body.removeChild(el);

</script>

</body>
</html>

Just replace this code as you want or ask chat gpt to change it as you want. If you want to add this to your app make your own website and let the website opent the html and let you website view with web viewer

And the result will be like this

My Fav Food

Ok. But what kind of block?