Copy and Paste function

Asked

Viewed 607 times

1

I wanted to copy and paste a string into a Listview, the function I’m using is just copying follows the function:

// Função Copiar
    private void copiarTarefa(Context context, String text) {
        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
            android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
            clipboard.setText(text);
        } else {
            android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
            android.content.ClipData clip = android.content.ClipData.newPlainText("Texto copiado: ", text);
            clipboard.setPrimaryClip(clip);
        }
        Toast.makeText(context, "Texto copiado", Toast.LENGTH_LONG).show();
    }

when I call the function so:

 // Copiar Nota
            listaTarefas.setLongClickable(true);
            listaTarefas.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
                @Override
                public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
                    copiarTarefa(getApplicationContext(), textoTarefa.getText().toString());
                    return true;

                }
            });

He just copies it, he doesn’t paste it, he just literally copies it.. where is the error, because I am not able to recover the note to be able to paste

  • 1

    Will copy from where and paste wave?

  • In the code I only see "copy". Where is the "paste"?

  • because it is Ramaral.. I wanted to know this

  • copy and paste to desktop, tas understanding ?

  • I wonder how I can put the necklace function

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.