Reputation: 520
I'm trying to clear the Clipboard data in android as follow but its not clearing it.
ClipboardManager clipman = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
clipman.setPrimaryClip(null);
Any ideas ?
Upvotes: 5
Views: 5180
Reputation: 496
Since API 11 ClipboardManager (as old ClipboardManager class is deprecated.)
ClipboardManager clipBoard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData data = ClipData.newPlainText("", "");
clipBoard.setPrimaryClip(data);
Upvotes: 19