Nafiul Islam
Nafiul Islam

Reputation: 31

Android Copy and Paste by onclick

I am a new android developer. I am trying to make a software which will store password (such as facebook password) of the user. These will be stored and shown as a vertical list view.All these were going properly.

But I want that when anybody will click on one(such as facebook password) of his passwords, that will be copied automatically and pasted on the next clicked edit text field(such as facebook password field) and it can be pasted only once. Once the user paste it, it will be removed from clipboard. But I don't know any method or way to remove the copied data from clipboard after pasting it once by the user. Please help me.

Upvotes: 3

Views: 2198

Answers (1)

Amg91
Amg91

Reputation: 164

Password normally the copy/paste is not enabled for security reasons.

If you want the onClick code, I believe this was asked before... let me know if wrong.

Check this link.

In the onClick:

ClipboardManager clipboard = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE); 
ClipData clip = ClipData.newPlainText(label, text);
clipboard.setPrimaryClip(clip);

Upvotes: 2

Related Questions