Android copy/paste from clipboard manager

you can copy and paste text using following code : for copy : ClipboardManager clipboard = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText(“your_text_to_be_copied”); clipboard.setPrimaryClip(clip); And paste it : ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); String pasteData = “”; // If it does contain data, decide if you can handle the data. if (!(clipboard.hasPrimaryClip())) { } else if (!(clipboard.getPrimaryClipDescription().hasMimeType(MIMETYPE_TEXT_PLAIN))) … Read more

Enable copy and paste on UITextField without making it editable

My final solution was the following: I created a subclass of UILabel (UITextField should work the same) that displays a UIMenuController after being tapped. CopyableLabel.m looks like this: @implementation CopyableLabel – (BOOL)canPerformAction:(SEL)action withSender:(id)sender { if(action == @selector(copy:)) { return YES; } else { return [super canPerformAction:action withSender:sender]; } } – (BOOL)canBecomeFirstResponder { return YES; } … Read more

Excel VBA How to detect if something was pasted in a Worksheet

Private Sub Worksheet_Change(ByVal Target As Range) Dim UndoList As String ‘~~> Get the undo List to capture the last action performed by user UndoList = Application.CommandBars(“Standard”).Controls(“&Undo”).List(1) ‘~~> Check if the last action was not a paste nor an autofill If Left(UndoList, 5) = “Paste” Then ‘Do stuff End If End Sub This did the trick. … Read more

Copy text string on click

You can attach copy event to <span> element, use document.execCommand(“copy”) within event handler, set event.clipboardData to span .textContent with .setData() method of event.clipboardData const span = document.querySelector(“span”); span.onclick = function() { document.execCommand(“copy”); } span.addEventListener(“copy”, function(event) { event.preventDefault(); if (event.clipboardData) { event.clipboardData.setData(“text/plain”, span.textContent); console.log(event.clipboardData.getData(“text”)) } }); <span>text</span>

How to Copy Text to Clip Board in Android?

use ClipboardManager ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText(label, text); clipboard.setPrimaryClip(clip); make sure you have imported android.content.ClipboardManager and NOT android.text.ClipboardManager. Latter is deprecated. Check this link for Further information.

Android: how to select texts from webview

The above answers looks perfectly fine and it seems you’re missing something while selecting text. So you need to double check the code and find your overridden any TouchEvent of webview. i Tried below code it works fine… Function is private void emulateShiftHeld(WebView view) { try { KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT, … Read more