I need to paste text into the Android emulator clipboard using adb shell. tried on Android 1.6 and 2.3.1
I tried to use adb shell command: clipboard:[android.text.iclipboard]
"service call clipboard" where service codes are 1, 2, and 3, for getClipboardText, setClipboardText, and hasClipboardText respectively.
service call clipboard 2 s16 thisisinsertedtext
does not seem to work while
service call clipboard 1
shows the content of clipboard:
service call clipboard 1
Result: Parcel(
0x00000000: 00000000 00000001 00000001 00000004 '................'
0x00000010: 00650074 00740078 00000000 't.e.x.t..... ')
Please advise how to set a value for emulator clipboard!
As you would just "CTRL+V" on windows, I just need to "CTRL+V" on Android if you know what I mean. Not directly through adb. If you have root, you could create a background system service that responds to an intent, and upon receiving the intent, inject a key sequence equivalent to paste (Ctrl + V).
On your Android device, open an app in which you can input text, such as Mail or Messages. Tap any area where you can enter text to display the keyboard. Tap the clipboard icon in the toolbar above the keyboard and you should see the text you copied from Windows. Tap the text to insert it into the current area.
Android provides the library of ClipboardManager and ClipData and ClipData. item to use the copying and pasting framework.In order to use clipboard framework, you need to put data into clip object, and then put that object into system wide clipboard.
Use below command.
service call clipboard 2 i32 1 i32 18 s16 thisisinsertedtext
I think that the first one, "i32 1" is how many elements in clipboard. So, just one. Second is a length of string. The command written above shows...
Result: Parcel(00000000 '....') This usually means OK, no error.
So, my question is, is there any way to copy unicode string? I mean, muti-byte character sets, like Korean. I tried many way, but it failed.
Looks like all 3 old methods are deprecated since API Level 11 so it won’t work for ICS
Not clear if it's even possible to make it work with service call clipboard anymore...
static final int TRANSACTION_getClipboardText 1
static final int TRANSACTION_hasClipboardText 3
static final int TRANSACTION_setClipboardText 2
www.androidjavadoc.com/1.0_r1_src/constant-values.html
http://developer.android.com/reference/android/content/ClipboardManager.html
http://developer.android.com/guide/topics/text/copy-paste.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With